audit: remove needless switch in AUDIT_SET

If userspace specified that it was setting values via the mask we do not
need a second check to see if they also set the version field high
enough to understand those values.  (clearly if they set the mask they
knew those values).

Signed-off-by: Eric Paris <eparis@redhat.com>
This commit is contained in:
Eric Paris 2014-01-13 16:49:28 -05:00
parent 70249a9cfd
commit 3f0c5fad89

View file

@ -834,22 +834,15 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
if (err < 0) if (err < 0)
return err; return err;
} }
switch (s.version) { if (s.mask & AUDIT_STATUS_BACKLOG_WAIT_TIME) {
/* add future vers # cases immediately below and allow if (sizeof(s) > (size_t)nlh->nlmsg_len)
* to fall through */ return -EINVAL;
case 2: if (s.backlog_wait_time < 0 ||
if (s.mask & AUDIT_STATUS_BACKLOG_WAIT_TIME) { s.backlog_wait_time > 10*AUDIT_BACKLOG_WAIT_TIME)
if (sizeof(s) > (size_t)nlh->nlmsg_len) return -EINVAL;
return -EINVAL; err = audit_set_backlog_wait_time(s.backlog_wait_time);
if (s.backlog_wait_time < 0 || if (err < 0)
s.backlog_wait_time > 10*AUDIT_BACKLOG_WAIT_TIME) return err;
return -EINVAL;
err = audit_set_backlog_wait_time(s.backlog_wait_time);
if (err < 0)
return err;
}
default:
break;
} }
break; break;
} }