lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bd13881e-6a78-8831-18a8-5b022e8648ce@nfschina.com>
Date:   Mon, 25 Jul 2022 17:54:15 +0800
From:   tury <renyu@...china.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     keescook@...omium.org, arnd@...db.de, linux-kernel@...r.kernel.org,
        liqiong@...china.com, yuzhe@...china.com
Subject: Re: [PATCH 2/3] lkdtm/perms: Check possible NULL pointer returned by
 kmalloc(),vmalloc()

When there is insufficient memory, the allocation will fail.

the return value is void,so i think it is ok .

should i have changed comment to something like this ?

As the possible alloc failure of the kmalloc() and vmalloc(),
the return pointer could be NULL.therefore it should be better to check it.


在 2022年07月25日 16:42, Greg KH 写道:
> On Mon, Jul 25, 2022 at 04:11:53PM +0800, Ren Yu wrote:
>> As the possible alloc failure of the kmalloc() and vmalloc(),the
>> return pointer could be NULL.therefore it should be better to check it.
>>
>> Signed-off-by: Ren Yu <renyu@...china.com>
>> ---
>>   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;
>> +
> Always run checkpatch on your patches so that grumpy maintainers do not
> 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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ