Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7719e437 authored by Harvey Harrison's avatar Harvey Harrison Committed by Al Viro
Browse files

[PATCH 2/2] audit: fix sparse shadowed variable warnings



Use msglen as the identifier.
kernel/audit.c:724:10: warning: symbol 'len' shadows an earlier one
kernel/audit.c:575:8: originally declared here

Don't use ino_f to check the inode field at the end of the functions.
kernel/auditfilter.c:429:22: warning: symbol 'f' shadows an earlier one
kernel/auditfilter.c:420:21: originally declared here
kernel/auditfilter.c:542:22: warning: symbol 'f' shadows an earlier one
kernel/auditfilter.c:529:21: originally declared here

i always used as a counter for a for loop and initialized to zero before
use.  Eliminate the inner i variables.
kernel/auditsc.c:1295:8: warning: symbol 'i' shadows an earlier one
kernel/auditsc.c:1152:6: originally declared here
kernel/auditsc.c:1320:7: warning: symbol 'i' shadows an earlier one
kernel/auditsc.c:1152:6: originally declared here

Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent c782f242
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -813,21 +813,21 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
	case AUDIT_MAKE_EQUIV: {
	case AUDIT_MAKE_EQUIV: {
		void *bufp = data;
		void *bufp = data;
		u32 sizes[2];
		u32 sizes[2];
		size_t len = nlmsg_len(nlh);
		size_t msglen = nlmsg_len(nlh);
		char *old, *new;
		char *old, *new;


		err = -EINVAL;
		err = -EINVAL;
		if (len < 2 * sizeof(u32))
		if (msglen < 2 * sizeof(u32))
			break;
			break;
		memcpy(sizes, bufp, 2 * sizeof(u32));
		memcpy(sizes, bufp, 2 * sizeof(u32));
		bufp += 2 * sizeof(u32);
		bufp += 2 * sizeof(u32);
		len -= 2 * sizeof(u32);
		msglen -= 2 * sizeof(u32);
		old = audit_unpack_string(&bufp, &len, sizes[0]);
		old = audit_unpack_string(&bufp, &msglen, sizes[0]);
		if (IS_ERR(old)) {
		if (IS_ERR(old)) {
			err = PTR_ERR(old);
			err = PTR_ERR(old);
			break;
			break;
		}
		}
		new = audit_unpack_string(&bufp, &len, sizes[1]);
		new = audit_unpack_string(&bufp, &msglen, sizes[1]);
		if (IS_ERR(new)) {
		if (IS_ERR(new)) {
			err = PTR_ERR(new);
			err = PTR_ERR(new);
			kfree(old);
			kfree(old);
+8 −8
Original line number Original line Diff line number Diff line
@@ -417,7 +417,7 @@ exit_err:
static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)
static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)
{
{
	struct audit_entry *entry;
	struct audit_entry *entry;
	struct audit_field *f;
	struct audit_field *ino_f;
	int err = 0;
	int err = 0;
	int i;
	int i;


@@ -499,9 +499,9 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule)
		}
		}
	}
	}


	f = entry->rule.inode_f;
	ino_f = entry->rule.inode_f;
	if (f) {
	if (ino_f) {
		switch(f->op) {
		switch(ino_f->op) {
		case AUDIT_NOT_EQUAL:
		case AUDIT_NOT_EQUAL:
			entry->rule.inode_f = NULL;
			entry->rule.inode_f = NULL;
		case AUDIT_EQUAL:
		case AUDIT_EQUAL:
@@ -526,7 +526,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
{
{
	int err = 0;
	int err = 0;
	struct audit_entry *entry;
	struct audit_entry *entry;
	struct audit_field *f;
	struct audit_field *ino_f;
	void *bufp;
	void *bufp;
	size_t remain = datasz - sizeof(struct audit_rule_data);
	size_t remain = datasz - sizeof(struct audit_rule_data);
	int i;
	int i;
@@ -654,9 +654,9 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
		}
		}
	}
	}


	f = entry->rule.inode_f;
	ino_f = entry->rule.inode_f;
	if (f) {
	if (ino_f) {
		switch(f->op) {
		switch(ino_f->op) {
		case AUDIT_NOT_EQUAL:
		case AUDIT_NOT_EQUAL:
			entry->rule.inode_f = NULL;
			entry->rule.inode_f = NULL;
		case AUDIT_EQUAL:
		case AUDIT_EQUAL:
+0 −2
Original line number Original line Diff line number Diff line
@@ -1293,7 +1293,6 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts
			break; }
			break; }


		case AUDIT_SOCKETCALL: {
		case AUDIT_SOCKETCALL: {
			int i;
			struct audit_aux_data_socketcall *axs = (void *)aux;
			struct audit_aux_data_socketcall *axs = (void *)aux;
			audit_log_format(ab, "nargs=%d", axs->nargs);
			audit_log_format(ab, "nargs=%d", axs->nargs);
			for (i=0; i<axs->nargs; i++)
			for (i=0; i<axs->nargs; i++)
@@ -1318,7 +1317,6 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts


	for (aux = context->aux_pids; aux; aux = aux->next) {
	for (aux = context->aux_pids; aux; aux = aux->next) {
		struct audit_aux_data_pids *axs = (void *)aux;
		struct audit_aux_data_pids *axs = (void *)aux;
		int i;


		for (i = 0; i < axs->pid_count; i++)
		for (i = 0; i < axs->pid_count; i++)
			if (audit_log_pid_context(context, axs->target_pid[i],
			if (audit_log_pid_context(context, axs->target_pid[i],