From: Chuck Lever <chuck.lever@oracle.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: nfs@lists.sourceforge.net
Subject: Re: [PATCH 05/10] NFS: Fix compiler warnings in fs/nfs/callback_xdr.c
Date: Tue, 29 May 2007 10:22:03 -0400 [thread overview]
Message-ID: <465C370B.7030707@oracle.com> (raw)
In-Reply-To: <1180203643.5517.16.camel@heimdal.trondhjem.org>
[-- Attachment #1: Type: text/plain, Size: 1727 bytes --]
Trond Myklebust wrote:
> On Fri, 2007-05-25 at 17:41 -0400, Chuck Lever wrote:
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>
>> fs/nfs/callback_xdr.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
>> index 849a202..d664193 100644
>> --- a/fs/nfs/callback_xdr.c
>> +++ b/fs/nfs/callback_xdr.c
>> @@ -139,7 +139,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound
>> if (unlikely(status != 0))
>> return status;
>> /* We do not like overly long tags! */
>> - if (hdr->taglen > CB_OP_TAGLEN_MAXSZ-12 || hdr->taglen < 0) {
>> + if (hdr->taglen > CB_OP_TAGLEN_MAXSZ - 12) {
>> printk("NFSv4 CALLBACK %s: client sent tag of length %u\n",
>> __FUNCTION__, hdr->taglen);
>> return htonl(NFS4ERR_RESOURCE);
>> @@ -379,7 +379,7 @@ static __be32 process_op(struct svc_rqst *rqstp,
>> }
>>
>> maxlen = xdr_out->end - xdr_out->p;
>> - if (maxlen > 0 && maxlen < PAGE_SIZE) {
>> + if (maxlen > 0 && maxlen < (long) PAGE_SIZE) {
> ^^^^^^ shouldn't be needed. We've just checked that maxlen > 0.
In this case, the "greater than zero" check is already there, so there
isn't a bug. However, PAGE_SIZE is defined as an "unsigned" value.
Comparing it to maxlen, which is "signed", produces a compiler warning.
The explicit cast documents that the signed versus unsigned comparison
is exactly what we want in this case.
Note that we included an explicit cast in the other fixes of this variety.
>> if (likely(status == 0 && op->decode_args != NULL))
>> status = op->decode_args(rqstp, xdr_in, argp);
>> if (likely(status == 0 && op->process_op != NULL))
>>
[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 291 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: 286 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
[-- Attachment #4: Type: text/plain, Size: 140 bytes --]
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
prev parent reply other threads:[~2007-05-29 14:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 21:41 [PATCH 05/10] NFS: Fix compiler warnings in fs/nfs/callback_xdr.c Chuck Lever
2007-05-26 18:20 ` Trond Myklebust
2007-05-29 14:22 ` Chuck Lever [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=465C370B.7030707@oracle.com \
--to=chuck.lever@oracle.com \
--cc=Trond.Myklebust@netapp.com \
--cc=nfs@lists.sourceforge.net \
/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.