* [PATCH 1/3] lkdtm/fortify: Check possible NULL pointer returned by kmalloc()
@ 2022-07-25 8:10 Ren Yu
2022-07-25 8:41 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Ren Yu @ 2022-07-25 8:10 UTC (permalink / raw)
To: keescook, arnd, gregkh, linux-kernel; +Cc: liqiong, yuzhe, Ren Yu
As the possible alloc failure of the kmalloc(),the return pointer
could be NULL,therefore it should be better to check it.
Signed-off-by: Ren Yu <renyu@nfschina.com>
---
drivers/misc/lkdtm/fortify.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/misc/lkdtm/fortify.c b/drivers/misc/lkdtm/fortify.c
index 080293fa3c52..5d70c5ef918b 100644
--- a/drivers/misc/lkdtm/fortify.c
+++ b/drivers/misc/lkdtm/fortify.c
@@ -41,6 +41,9 @@ static void lkdtm_FORTIFIED_SUBOBJECT(void)
char *src;
src = kmalloc(size, GFP_KERNEL);
+ if (!src)
+ return;
+
strscpy(src, "over ten bytes", size);
size = strlen(src) + 1;
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/3] lkdtm/fortify: Check possible NULL pointer returned by kmalloc()
2022-07-25 8:10 [PATCH 1/3] lkdtm/fortify: Check possible NULL pointer returned by kmalloc() Ren Yu
@ 2022-07-25 8:41 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2022-07-25 8:41 UTC (permalink / raw)
To: Ren Yu; +Cc: keescook, arnd, linux-kernel, liqiong, yuzhe
On Mon, Jul 25, 2022 at 04:10:00PM +0800, Ren Yu wrote:
> As the possible alloc failure of the kmalloc(),the return pointer
> could be NULL,therefore it should be better to check it.
>
> Signed-off-by: Ren Yu <renyu@nfschina.com>
> ---
> drivers/misc/lkdtm/fortify.c | 3 +++
> 1 file changed, 3 insertions(+)
For some reason this patch series is not properly threaded, so our tools
can not pick them up automatically. Can you please resend them threaded
properly (git send-email can do this for you)?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-25 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 8:10 [PATCH 1/3] lkdtm/fortify: Check possible NULL pointer returned by kmalloc() Ren Yu
2022-07-25 8:41 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®