The patch titled drivers/video: add kmalloc NULL tests has been added to the -mm tree. Its filename is drivers-video-add-kmalloc-null-tests.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: drivers/video: add kmalloc NULL tests From: Julia Lawall <julia@xxxxxxx> Check that the result of kmalloc is not NULL before passing it to other functions. 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@xxxxxxx> Cc: Ming Lei <tom.leiming@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/video/au1100fb.c | 4 ++++ 1 file changed, 4 insertions(+) diff -puN drivers/video/au1100fb.c~drivers-video-add-kmalloc-null-tests drivers/video/au1100fb.c --- a/drivers/video/au1100fb.c~drivers-video-add-kmalloc-null-tests +++ a/drivers/video/au1100fb.c @@ -716,6 +716,10 @@ int au1100fb_setup(char *options) /* Mode option (only option that start with digit) */ else if (isdigit(this_opt[0])) { mode = kmalloc(strlen(this_opt) + 1, GFP_KERNEL); + if (!mode) { + print_err("memory allocation failed"); + return -ENOMEM; + } strncpy(mode, this_opt, strlen(this_opt) + 1); } /* Unsupported option */ _ Patches currently in -mm which might be from julia@xxxxxxx are linux-next.patch drivers-media-dvb-use-dst_type-field-instead-of-type_flags.patch drivers-ata-use-resource_size.patch drivers-mmc-correct-error-handling-code.patch drivers-rtc-correct-error-handling-code.patch drivers-video-imxfbc-fix-resource-size-off-by-1-error.patch drivers-video-add-kmalloc-null-tests.patch edac-fix-resource-size-calculation.patch fs-romfs-correct-error-handling-code.patch drivers-vlynq-vlynqc-fix-resource-size-off-by-1-error.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html