[PATCH] XFS: Use a signed return type for suffix_kstrtoint()

Dave Chinner david at fromorbit.com
Mon Dec 21 15:53:35 CST 2015


On Mon, Dec 21, 2015 at 12:35:55PM -0600, Eric Sandeen wrote:
> On 12/20/15 1:00 AM, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring at users.sourceforge.net>
> > Date: Sun, 20 Dec 2015 07:56:36 +0100
> > 
> > The return type "unsigned long" was used by the suffix_kstrtoint()
> > function even though it will eventually return a negative error code.
> 
> > Improve this implementation detail by using the type "int" instead.
> > 
> > This issue was detected by using the Coccinelle software.
> 
> > Signed-off-by: Markus Elfring <elfring at users.sourceforge.net>
> 
> yep, looks like an oversight left over from a17164e5
> 
> Harmless, because callers only check for non-zero value, but still
> worth fixing.

Perhaps addressing the actual bug in that code would be a more
appropriate use of our time. i.e. the undetected integer overflow
on left shift....

Cheers,

Dave.
-- 
Dave Chinner
david at fromorbit.com



More information about the xfs mailing list