[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <82054a0a-72e5-45b2-8808-e411a9587406@web.de>
Date: Wed, 10 Jan 2024 11:58:12 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Michael Kelley <mhklinux@...look.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
Dexuan Cui <decui@...rosoft.com>, Haiyang Zhang <haiyangz@...rosoft.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>, Wei Liu <wei.liu@...nel.org>,
"cocci@...ia.fr" <cocci@...ia.fr>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: Drivers: hv: vmbus: One function call less in
create_gpadl_header() after error detection
>> The kfree() function was called in two cases by
>> the create_gpadl_header() function during error handling
>> even if the passed variable contained a null pointer.
>> This issue was detected by using the Coccinelle software.
>>
>> Thus use another label.
>
> Interestingly, there's a third case in this function where
> "goto nomem" is done, and in this case, msgbody is NULL.
> Does Coccinelle not complain about that case as well?
>
> As I'm sure you know, the code is correct as is, because kfree()
> checks for a NULL argument. So this is really an exercise in
> making Coccinelle happy. To me, the additional label is
> incremental complexity for someone to deal with when
> reading the code at some time in the future. So I'd vote for
> leaving the code as is. But it's not a big deal either way. I
> can see you've been cleaning up a lot of Coccinelle-reported
> issues across the kernel, most of which result in code
> simplifications. If leaving this unchanged causes you problems,
> then I won't object (though perhaps that 3rd "goto nomem"
> should be dealt with as well for consistency).
How do you think about the clarification approach
“Reconsidering kfree() calls for null pointers (with SmPL)”?
https://lore.kernel.org/cocci/6cbcf640-55e5-2f11-4a09-716fe681c0d2@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2023-03/msg00096.html
Regards,
Markus
Powered by blists - more mailing lists