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] [day] [month] [year] [list]
Message-ID: <dd9faaa9-72ea-445d-b687-5005ede01b09@arm.com>
Date: Thu, 29 Aug 2024 13:44:39 +0530
From: Dev Jain <dev.jain@....com>
To: Markus Elfring <Markus.Elfring@....de>,
 Zhu Jun <zhujun2@...s.chinamobile.com>, linux-mm@...ck.org,
 kernel-janitors@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: tools/mm: Use calloc and check the potential memory allocation
 failure


On 8/29/24 13:25, Markus Elfring wrote:
>>>> Replace malloc with calloc and add memory allocating check
>>>                         memset(…, 0, …) call by calloc()?
>> Calloc returns zeroed-out memory.
> I propose to improve the change description considerably.
>
>
>>>> of comm_str before used.
>>> * Add also a null pointer check for the detection of a memory allocation failure.
>> Which is exactly what Zhu has done?
> Can the commit message become nicer anyhow?

I agree. The commit message should note two things, first that
a malloc followed by a memset to 0 can be reduced to single calloc,
and second that, "add memory allocating check" can be replaced by
"add null pointer check in case of allocation failure".

>
>
> …
>>> * How do you think about to omit the statement “fprintf(stderr, "Out of memory\n");”?
>> Why?
> I imagine that a returned null pointer can eventually be sufficient already.
> Would you get helpful background information from the variable “errno”?

In case of calloc failure, errno is always set to ENOMEM, so we are guaranteed
that any failure is an out of memory failure.

>
> Regards,
> Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ