All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net
Subject: Re: [PATCH 03/20] SUNRPC: Fix some signed v. unsigned comparisons in xprtsock.c
Date: Mon, 13 Aug 2007 10:10:29 -0400	[thread overview]
Message-ID: <46C06655.6030706@oracle.com> (raw)
In-Reply-To: <1186843423.17941.18.camel@heimdal.trondhjem.org>

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

Trond Myklebust wrote:
> On Mon, 2007-08-06 at 11:56 -0400, Chuck Lever wrote:
>> Currently these are not harmful because the range of "len" is less than the
>> size of a page.
> 
> NACK. It is always safe to test an unsigned quantity against a signed
> quantity for equality, _provided_ that the two quantities are the same
> size. Since we're comparing an unsigned int to an int, that is clearly
> the case here.
> 
> The explicit cast is not only unnecessary, but it is actually bad, since
> it may obscure any future comparison errors should we ever for some
> reason decide to change the size of err.

As an aside, the purpose of the patches fixing these casts is not just 
to correct run-time bugs, but also to eliminate compiler and sparse 
warnings, which in some cases are simply extraneous noise due to 
compiler pickiness, but can sometimes be nasty bugs (as we found out in 
fs/nfs/direct.c, recently).

Eventually I think we should use sparse as part of a check-in test 
suite, and -Wall all the time for building both fs/nfs and net/sunrpc, 
as this setting does catch valid bugs.  In that event, eliminating 
spurious compiler and sparse warnings will cut down on noise and make it 
easy to spot new problems as we are developing.

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 290 bytes --]

begin:vcard
fn:Chuck Lever
n:Lever;Chuck
org:Oracle Corporation;Corporate Architecture: Linux Projects Group
adr:;;1015 Granger Avenue;Ann Arbor;MI;48104;USA
title:Principal Member of Staff
tel;work:+1 248 614 5091
x-mozilla-html:FALSE
url:http://oss.oracle.com/~cel
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 315 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

  reply	other threads:[~2007-08-13 17:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-06 15:56 [PATCH 03/20] SUNRPC: Fix some signed v. unsigned comparisons in xprtsock.c Chuck Lever
2007-08-11 14:43 ` Trond Myklebust
2007-08-13 14:10   ` Chuck Lever [this message]
2007-08-13 17:42     ` Trond Myklebust

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=46C06655.6030706@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=nfs@lists.sourceforge.net \
    --cc=trond.myklebust@fys.uio.no \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.