From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: nfs@lists.sourceforge.net, trond.myklebust@fys.uio.no
Subject: Re: [PATCH 08/27] SUNRPC: Prevent length underflow in read_flush()
Date: Fri, 26 Oct 2007 14:49:23 -0400 [thread overview]
Message-ID: <20071026184923.GI13033@fieldses.org> (raw)
In-Reply-To: <20071026173120.31475.76007.stgit@manray.1015granger.net>
On Fri, Oct 26, 2007 at 01:31:20PM -0400, Chuck Lever wrote:
> Make sure we compare an unsigned length to an unsigned count in
> read_flush().
OK by me, thanks. This motivated by the hope of being able to turn on
more compile warnings some day?
--b.
>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>
> net/sunrpc/cache.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index 8e05557..578084f 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -1242,18 +1242,18 @@ static ssize_t read_flush(struct file *file, char __user *buf,
> struct cache_detail *cd = PDE(file->f_path.dentry->d_inode)->data;
> char tbuf[20];
> unsigned long p = *ppos;
> - int len;
> + size_t len;
>
> sprintf(tbuf, "%lu\n", cd->flush_time);
> len = strlen(tbuf);
> if (p >= len)
> return 0;
> len -= p;
> - if (len > count) len = count;
> + if (len > count)
> + len = count;
> if (copy_to_user(buf, (void*)(tbuf+p), len))
> - len = -EFAULT;
> - else
> - *ppos += len;
> + return -EFAULT;
> + *ppos += len;
> return len;
> }
>
>
>
> -------------------------------------------------------------------------
> 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/
> _______________________________________________
> NFS maillist - NFS@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nfs
-------------------------------------------------------------------------
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/
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2007-10-26 18:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-26 17:31 [PATCH 08/27] SUNRPC: Prevent length underflow in read_flush() Chuck Lever
2007-10-26 18:25 ` Trond Myklebust
2007-10-26 18:49 ` J. Bruce Fields [this message]
2007-10-29 15:30 ` Chuck Lever
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=20071026184923.GI13033@fieldses.org \
--to=bfields@fieldses.org \
--cc=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.