* kernel/auditsc.c bug
@ 2005-12-24 3:17 Lee Revell
2005-12-24 3:28 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Lee Revell @ 2005-12-24 3:17 UTC (permalink / raw)
To: linux-kernel; +Cc: Rickard E. (Rik) Faith
gcc 4.0.2 complains that state is (not "may be", is) used initialized on
line 607:
605 list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {
606 if (audit_filter_user_rules(cb, &e->rule, &state)) {
607 if (state == AUDIT_DISABLED)
608 ret = 0;
609 break;
610 }
AFAICT state will always have been initialized if
audit_filter_user_rules() returns nonzero:
590 switch (rule->action) {
591 case AUDIT_NEVER: *state = AUDIT_DISABLED; break;
592 case AUDIT_POSSIBLE: *state = AUDIT_BUILD_CONTEXT; break;
593 case AUDIT_ALWAYS: *state = AUDIT_RECORD_CONTEXT; break;
594 }
595 return 1;
Is GCC correct that this is a bug (no default case in the switch
statement)?
Lee
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: kernel/auditsc.c bug
2005-12-24 3:17 kernel/auditsc.c bug Lee Revell
@ 2005-12-24 3:28 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2005-12-24 3:28 UTC (permalink / raw)
To: Lee Revell; +Cc: linux-kernel, Rickard E. (Rik) Faith
On Friday 23 December 2005 22:17, Lee Revell wrote:
> gcc 4.0.2 complains that state is (not "may be", is) used initialized on
> line 607:
>
> 605 list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {
> 606 if (audit_filter_user_rules(cb, &e->rule, &state)) {
> 607 if (state == AUDIT_DISABLED)
> 608 ret = 0;
> 609 break;
> 610 }
>
> AFAICT state will always have been initialized if
> audit_filter_user_rules() returns nonzero:
>
> 590 switch (rule->action) {
> 591 case AUDIT_NEVER: *state = AUDIT_DISABLED; break;
> 592 case AUDIT_POSSIBLE: *state = AUDIT_BUILD_CONTEXT; break;
> 593 case AUDIT_ALWAYS: *state = AUDIT_RECORD_CONTEXT; break;
> 594 }
> 595 return 1;
>
> Is GCC correct that this is a bug (no default case in the switch
> statement)?
>
Well, rule actions are #defines, how can a compiler know that the switch
covers all possible values? If they were enums OTOH...
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-12-24 3:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-24 3:17 kernel/auditsc.c bug Lee Revell
2005-12-24 3:28 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox