classify.c: Initialize struct user_irq_policy

commit 2139f8a895 "make hintpolicy user
policy configurable" introduced a regression where if the user does not
provide a policy script the user_irq_policy struct will not be
initialized.

The common pattern for get_irq_user_policy() is that a struct
user_irq_policy is allocated on the stack, get_irq_user_policy() is
called, and then pol.ban == 1 is tested.  Without a policy script this
became undefined since the struct was not being initialized.

Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com>
This commit is contained in:
Shawn Bohrer 2014-09-06 22:26:41 -05:00
parent 55aa3e9bf1
commit c41f90cb12

View file

@ -325,13 +325,13 @@ static void get_irq_user_policy(char *path, int irq, struct user_irq_policy *pol
char buffer[128];
char *brc;
memset(pol, -1, sizeof(struct user_irq_policy));
pol->hintpolicy = global_hint_policy;
/* Return defaults if no script was given */
if (!polscript)
return;
memset(pol, -1, sizeof(struct user_irq_policy));
pol->hintpolicy = global_hint_policy;
cmd = alloca(strlen(path)+strlen(polscript)+64);
if (!cmd)
return;