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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux