mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernfs: Fix kernfs_name_compare
Date: Thu, 4 Dec 2014 11:53:20 -0500	[thread overview]
Message-ID: <20141204165320.GA2995@htj.dyndns.org> (raw)
In-Reply-To: <1417709976-31551-1-git-send-email-linux@rasmusvillemoes.dk>

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

  reply	other threads:[~2014-12-04 16:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04 16:19 Rasmus Villemoes
2014-12-04 16:53 ` Tejun Heo [this message]
2014-12-05 22:41 ` [PATCH v2] " Rasmus Villemoes
2015-01-05 14:13   ` Tejun Heo
2015-01-05 16:14     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141204165320.GA2995@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®