fortify: Increase pointer assignment check
Subsystems (2)
PATCH 1/1 fortify: Increase pointer assignment check
Increase the check after the src pointer allocates memory. If these two functions are used, at least increase some robustness.
Signed-off-by Li zeming <[email protected]>
--- drivers/misc/lkdtm/fortify.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/misc/lkdtm/fortify.c +6 -0
@@ -44,6 +44,9 @@ static void lkdtm_FORTIFY_STR_MEMBER(void)char *src; src =kmalloc (size,GFP_KERNEL ); +if (src ==NULL ) +return ; +strscpy (src,"over ten bytes" , size); size =strlen (src) +1 ;
@@ -109,6 +112,9 @@ static void lkdtm_FORTIFY_MEM_MEMBER(void)char *src; src =kmalloc (size,GFP_KERNEL ); +if (src ==NULL ) +return ; +strscpy (src,"over ten bytes" , size); size =strlen (src) +1 ;
Signature · 1 line
2.18.2