summaryrefslogtreecommitdiff
path: root/sound/aoa/core
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2009-07-31 10:32:03 +0400
committerTakashi Iwai <tiwai@suse.de>2009-07-31 12:14:58 +0400
commitf065fabc864f4c98857bf67caa2365e9f8545751 (patch)
tree5b5620ab40935a9e4dfc16a68f9b6e6e64c6d087 /sound/aoa/core
parent34fdeb2d07102e07ecafe79dec170bd6733f2e56 (diff)
downloadlinux-f065fabc864f4c98857bf67caa2365e9f8545751.tar.xz
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>
Diffstat (limited to 'sound/aoa/core')
-rw-r--r--sound/aoa/core/gpio-pmf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/aoa/core/gpio-pmf.c b/sound/aoa/core/gpio-pmf.c
index 5ca2220eac7d..1dd0c28d1fb7 100644
--- a/sound/aoa/core/gpio-pmf.c
+++ b/sound/aoa/core/gpio-pmf.c
@@ -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;