>> 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

Reply via email to