Linux NFS development
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: "Talpey, Thomas" <Thomas.Talpey@netapp.com>
Cc: nfs@lists.sourceforge.net
Subject: Re: [PATCH] SUNRPC: Fix xdr_decode_string_inplace() mixed sign comparison
Date: Wed, 31 Oct 2007 13:56:49 -0400	[thread overview]
Message-ID: <4728C1E1.7060006@oracle.com> (raw)
In-Reply-To: <EXNANE014r3mbfJ8VrR0000085c@exnane01.hq.netapp.com>

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

Talpey, Thomas wrote:
> At 01:29 PM 10/31/2007, Chuck Lever wrote:
>> My proposal is to make all the variables in xdr_decode_string_inplace of 
>> type u32, and then work backwards into the ULPs, changing the length 
>> variables of type int to type u32.
> 
> I'd suggest a slight variation - using u32 where the variables shadow
> objects which are decoded/encoded off the wire, but using a native
> type (unsigned int/int) after they are actually passed outside xdr.

Converting XDR types to native types makes sense, I guess.

> For example, the length here is u32 within the xdr routine, but after
> it's decoded, it's really not something we'd want to pass to
> memcpy. IOW, it seems ok to me to have the "maxlen" argument
> remain an int (maybe unsigned), but the internal "len" is naturally u32.

I can't see why we need to handle negative string length values in most 
places, so the length variables should be made unsigned, at least. 
Trond insisted that *lenp and maxlen must be same type here.

However, it seems to me that native string lengths should be size_t. 
(ie the same type that strlen() returns).

[-- Attachment #2: chuck.lever.vcf --]
[-- Type: text/x-vcard, Size: 259 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
version:2.1
end:vcard


[-- Attachment #3: Type: text/plain, Size: 314 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-10-31 17:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-31 16:50 [PATCH] SUNRPC: Fix xdr_decode_string_inplace() mixed sign comparison Chuck Lever
2007-10-31 17:06 ` Talpey, Thomas
2007-10-31 17:29   ` Chuck Lever
2007-10-31 17:41     ` Talpey, Thomas
2007-10-31 17:56       ` Chuck Lever [this message]
2007-10-31 18:06         ` Talpey, Thomas
2007-10-31 19:00   ` Trond Myklebust
2007-10-31 19:14     ` Talpey, Thomas
2007-11-01  1:53     ` Chuck Lever
2007-11-01  3:58       ` Trond Myklebust
2007-11-01 15:37         ` Chuck Lever
2007-11-01 15:45           ` 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=4728C1E1.7060006@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=Thomas.Talpey@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox