From: Tushar Behera <tushar.behera@linaro.org>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"patches@linaro.org" <patches@linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>
Subject: Re: [Xen-devel] [PATCH 09/14] xen: events: Remove redundant check on unsigned variable
Date: Mon, 19 Nov 2012 16:30:16 +0530 [thread overview]
Message-ID: <50AA1140.70103@linaro.org> (raw)
In-Reply-To: <1353321075.18229.29.camel@zakaz.uk.xensource.com>
On 11/19/2012 04:01 PM, Ian Campbell wrote:
> On Mon, 2012-11-19 at 03:52 +0000, Tushar Behera wrote:
>> On 11/16/2012 10:23 PM, Jeremy Fitzhardinge wrote:
>>> To be honest I'd nack this kind of patch. The test is only redundant in the most trivial sense that the compiler can easily optimise away. The point of the test is to make sure that the range is OK even if the type subsequently becomes signed (to hold a -ve error, for example).
>>>
>>> J
>>>
>>
>> The check is on the function argument which is unsigned, so checking '<
>> 0' doesn't make sense. We should force signed check only if the argument
>> is of signed type. In any case, even if irq has been assigned some error
>> value, that would be caught by the check irq >= nr_irqs.
>
> Jeremy is (I think) arguing that this check is not redundant because
> someone might change the type of the argument to be signed and until
> then the compiler can trivially optimise the check away, so what's the
> harm in it?
>
> I'm somewhat inclined to agree with him.
>
> Ian.
>
Ok, I don't have much argument against this.
--
Tushar Behera
prev parent reply other threads:[~2012-11-19 11:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-16 6:50 [PATCH 00/14] Modify signed comparisons of unsigned variables Tushar Behera
2012-11-16 6:50 ` [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable Tushar Behera
2012-11-16 9:16 ` Ian Campbell
2012-12-28 5:15 ` Tushar Behera
2012-12-28 10:41 ` [Xen-devel] " Wei Liu
2013-01-02 21:40 ` Konrad Rzeszutek Wilk
2012-11-16 6:50 ` [PATCH 09/14] xen: events: " Tushar Behera
2012-11-16 16:09 ` Konrad Rzeszutek Wilk
2012-11-16 16:53 ` Jeremy Fitzhardinge
2012-11-19 3:52 ` Tushar Behera
2012-11-19 10:31 ` Ian Campbell
2012-11-19 11:00 ` Tushar Behera [this message]
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=50AA1140.70103@linaro.org \
--to=tushar.behera@linaro.org \
--cc=Ian.Campbell@citrix.com \
--cc=jeremy@goop.org \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xensource.com \
/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;
as well as URLs for NNTP newsgroup(s).