[lustre-devel] [PATCH v2] staging/lustre/ptlrpc: Removes potential null dereference

Dan Carpenter dan.carpenter at oracle.com
Tue May 17 16:39:22 UTC 2016


On Tue, May 17, 2016 at 10:22:20AM -0400, Lidza Louina wrote:
> if (rc < 0) and if (rc) pretty much translates to the same thing.

I wasn't talking about this patch in particular; it's just something I
have thinking about recently.  For example, there are a lot of functions
that don't initialize parameters if they return a non-zero value, but
the caller checks for negatives.  It's often tricky or impossible to
determine that these mean the same thing just from analysing the code
without making assumptions.

I think "if (rc) " is more common than "if (rc < 0)".  I also think it's
prettier code.  But mostly I wish people would do it all consistently.

regards,
dan carpenter


More information about the devel mailing list