>> 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@xxxxxx/ https://sympa.inria.fr/sympa/arc/cocci/2023-03/msg00096.html Regards, Markus