lkml.org 
[lkml]   [2014]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernfs: Fix kernfs_name_compare
Hello,

On Thu, Dec 04, 2014 at 05:19:34PM +0100, Rasmus Villemoes wrote:
...
> {
> + /*
> + * This is ok because the hash values are restricted to [0,
> + * 2^31-1] and because we are returning int (it would be wrong
> + * had the return type been wider!).
> + */
> if (hash != kn->hash)
> return hash - kn->hash;

Let's just do < > comparisons here too and just note that trying to
determine ordering through subtraction is dangerous.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2014-12-04 18:21    [W:0.052 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site