Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lkdtm: fortify: Fix potential NULL dereference on kmalloc failure

Add missing NULL pointer checks after kmalloc() calls in
lkdtm_FORTIFY_STR_MEMBER() and lkdtm_FORTIFY_MEM_MEMBER() functions.

Signed-off-by: Junjie Cao <junjie.cao@intel.com>
Link: https://lore.kernel.org/r/20250814060605.5264-1-junjie.cao@intel.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Junjie Cao and committed by
Kees Cook
01c7344e c17b750b

+6
+6
drivers/misc/lkdtm/fortify.c
··· 44 44 char *src; 45 45 46 46 src = kmalloc(size, GFP_KERNEL); 47 + if (!src) 48 + return; 49 + 47 50 strscpy(src, "over ten bytes", size); 48 51 size = strlen(src) + 1; 49 52 ··· 112 109 char *src; 113 110 114 111 src = kmalloc(size, GFP_KERNEL); 112 + if (!src) 113 + return; 114 + 115 115 strscpy(src, "over ten bytes", size); 116 116 size = strlen(src) + 1; 117 117