Re: [PATCH] gfs2: Move a variable assignment behind a null pointer check in inode_go_dump()

Markus Elfring <[email protected]> Mon, 13 Jul 2026 14:04:46 +0200
Newsgroups org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
>> The address of a data structure member was determined before
>> a corresponding null pointer check in the implementation of
>> the function “inode_go_dump”.
>>
>> Thus avoid the risk for undefined behaviour by moving the assignment
>> for the variable “inode” behind the null pointer check.
>>
>> This issue was detected by using the Coccinelle software.
>>
>> Fixes: 27a2660f1ef944724956d92e8a312b6da0936fae ("gfs2: Dump nrpages for inodes and their glocks")
> 
> Okay, that's a worthwhile cleanup.

Thanks for a bit of positive feedback.

Why is this implementation detail still questionable so far?
https://elixir.bootlin.com/linux/v7.2-rc2/source/fs/gfs2/glops.c#L541-L565


>                                    It doesn't actually fix a bug, so
> I'm not going to add a Fixes tag, though.

How does your view fit to information in an article like “Fun with NULL pointers, part 1”
(by Jonathan Corbet from 2009-07-20)?
https://lwn.net/Articles/342330/

Regards,
Markus