On Mon, Jul 25, 2022 at 04:11:53PM +0800, Ren Yu wrote:
As the possible alloc failure of the kmalloc() and vmalloc(),theAlways run checkpatch on your patches so that grumpy maintainers do not
return pointer could be NULL.therefore it should be better to check it.
Signed-off-by: Ren Yu <renyu@xxxxxxxxxxxx>
---
drivers/misc/lkdtm/perms.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/misc/lkdtm/perms.c b/drivers/misc/lkdtm/perms.c
index b93404d65650..34b43b9ea1f1 100644
--- a/drivers/misc/lkdtm/perms.c
+++ b/drivers/misc/lkdtm/perms.c
@@ -180,6 +180,9 @@ static void lkdtm_EXEC_STACK(void)
static void lkdtm_EXEC_KMALLOC(void)
{
u32 *kmalloc_area = kmalloc(EXEC_SIZE, GFP_KERNEL);
+ if (!kmalloc_area)
+ return;
+
have to tell you to run checkpatch on your patches...
Also, shouldn't this return an error?
But most importantly, how can this ever fail?
thanks,
greg k-h