[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ea4117d5-bc70-4f6d-9fe4-e70e0cc47a6c@web.de>
Date: Thu, 18 Jan 2024 09:38:49 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Dan Carpenter <dan.carpenter@...aro.org>,
linux-hardening@...r.kernel.org, kernel-janitors@...r.kernel.org,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>,
Joel Fernandes <joel@...lfernandes.org>, Kees Cook <keescook@...omium.org>,
Tony Luck <tony.luck@...el.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Günter Röck
<groeck@...omium.org>, Sai Prakash Ranjan
<saiprakash.ranjan@...eaurora.org>, Kunwu Chan <chentao@...inos.cn>
Subject: Re: [PATCH] pstore/ram: Return directly after a failed kasprintf()
call in ramoops_init_prz()
>> The result from a call of the function “kasprintf” was passed to
>> a subsequent function call without checking for a null pointer before
>> (according to a memory allocation failure).
>> This issue was detected by using the Coccinelle software.
…
>> +++ b/fs/pstore/ram.c
>> @@ -595,6 +595,9 @@ static int ramoops_init_prz(const char *name,
>> }
>>
>> label = kasprintf(GFP_KERNEL, "ramoops:%s", name);
>> + if (!label)
>> + return -ENOMEM;
>> +
>> *prz = persistent_ram_new(*paddr, sz, sig, &cxt->ecc_info,
>> cxt->memtype, PRZ_FLAG_ZAP_OLD, label);
>> kfree(label);
>
> This patch is fine as a clean up, but I think it's useful to say that
> if you pass a NULL label to persistent_ram_new() then it will return
> an error.
…
Will it become helpful to annotate the corresponding function input parameter
for null pointer tolerance anyhow?
Regards,
Markus
Powered by blists - more mailing lists