Re: [PATCH] kernfs: Fix kernfs_name_compare

From: Tejun Heo
Date: Thu Dec 04 2014 - 11:53:29 EST


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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/