Re: [PATCH] Drivers: hv: vmbus: One function call less in create_gpadl_header() after error detection

From: Dan Carpenter
Date: Wed Jan 10 2024 - 06:29:52 EST


On Wed, Jan 10, 2024 at 05:41:00AM +0000, Michael Kelley wrote:
> From: Markus Elfring <Markus.Elfring@xxxxxx> Sent: Tuesday, December 26, 2023 11:09 AM
> >
> > 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.

Coccinelle is a kind of tool to search code. Markus has created his own
search. It's not a part of the standard Coccinelle scripts in
scripts/coccinelle/ or a CodingStyle issue or anything. It's just a
matter of Markus prefering one style over another.

regards,
dan carpenter