ALSA: sound/aoa: Add kmalloc NULL tests
Check that the result of kzalloc is not NULL before a dereference. The semantic match that finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @@ expression *x; identifier f; constant char *C; @@ x = \(kmalloc\|kcalloc\|kzalloc\)(...); ... when != x == NULL when != x != NULL when != (x || ...) ( kfree(x) | f(...,C,...,x,...) | *f(...,x,...) | *x->f ) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
34fdeb2d07
commit
f065fabc86
|
@ -182,6 +182,10 @@ static int pmf_set_notify(struct gpio_runtime *rt,
|
|||
if (!old && notify) {
|
||||
irq_client = kzalloc(sizeof(struct pmf_irq_client),
|
||||
GFP_KERNEL);
|
||||
if (!irq_client) {
|
||||
err = -ENOMEM;
|
||||
goto out_unlock;
|
||||
}
|
||||
irq_client->data = notif;
|
||||
irq_client->handler = pmf_handle_notify_irq;
|
||||
irq_client->owner = THIS_MODULE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user