Skip to content

Commit 42f7446

Browse files
rgbriggseparis
authored andcommitted
audit: change decimal constant to macro for invalid uid
SFR reported this 2013-05-15: > After merging the final tree, today's linux-next build (i386 defconfig) > produced this warning: > > kernel/auditfilter.c: In function 'audit_data_to_entry': > kernel/auditfilter.c:426:3: warning: this decimal constant is unsigned only > in ISO C90 [enabled by default] > > Introduced by commit 780a765 ("audit: Make testing for a valid > loginuid explicit") from Linus' tree. Replace this decimal constant in the code with a macro to make it more readable (add to the unsigned cast to quiet the warning). Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent 0868a5e commit 42f7446

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎include/uapi/linux/audit.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,8 @@ struct audit_tty_status {
380380
__u32 log_passwd; /* 1 = enabled, 0 = disabled */
381381
};
382382

383+
#define AUDIT_UID_UNSET (unsigned int)-1
384+
383385
/* audit_rule_data supports filter rules with both integer and string
384386
* fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
385387
* AUDIT_LIST_RULES requests.

‎kernel/auditfilter.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
423423
f->lsm_rule = NULL;
424424

425425
/* Support legacy tests for a valid loginuid */
426-
if ((f->type == AUDIT_LOGINUID) && (f->val == ~0U)) {
426+
if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) {
427427
f->type = AUDIT_LOGINUID_SET;
428428
f->val = 0;
429429
}

0 commit comments

Comments
 (0)