From: Andrew Morton <akpm@linux-foundation.org>
To: roel kluin <roel.kluin@gmail.com>
Cc: linux-kernel@vger.kernel.org, Tom Zanussi <zanussi@us.ibm.com>,
Tom Zanussi <zanussi@comcast.net>,
Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] relay: When unsigned ret cannot store a negative value
Date: Tue, 2 Dec 2008 14:10:42 -0800 [thread overview]
Message-ID: <20081202141042.3e0db395.akpm@linux-foundation.org> (raw)
In-Reply-To: <493161DE.6000703@gmail.com>
On Sat, 29 Nov 2008 10:38:06 -0500
roel kluin <roel.kluin@gmail.com> wrote:
> When unsigned ret cannot store a negative value
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> UNTESTED! is this the way to go?
>
> diff --git a/kernel/relay.c b/kernel/relay.c
> index 32b0bef..c9d62e5 100644
> --- a/kernel/relay.c
> +++ b/kernel/relay.c
> @@ -1220,7 +1220,8 @@ static int subbuf_splice_actor(struct file *in,
> unsigned int flags,
> int *nonpad_ret)
> {
> - unsigned int pidx, poff, total_len, subbuf_pages, nr_pages, ret;
> + unsigned int pidx, poff, total_len, subbuf_pages, nr_pages;
> + ssize_t ret;
> struct rchan_buf *rbuf = in->private_data;
> unsigned int subbuf_size = rbuf->chan->subbuf_size;
> uint64_t pos = (uint64_t) *ppos;
> @@ -1289,7 +1290,8 @@ static int subbuf_splice_actor(struct file *in,
> if (!spd.nr_pages)
> return 0;
>
> - ret = *nonpad_ret = splice_to_pipe(pipe, &spd);
> + ret = splice_to_pipe(pipe, &spd);
> + *nonpad_ret = ret;
> if (ret < 0 || ret < total_len)
> return ret;
>
Yeah, this code needs help. subbuf_splice_actor() returns `int', but
carefully calculates and returns an unsigned type.
I suspect that quite a bit of code in there (including
relay_file_splice_read()) should be gone through and have its choice of
types reviewed and fixed. Probably by converting things to ssize_t.
next prev parent reply other threads:[~2008-12-02 22:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-29 15:38 [PATCH] relay: When unsigned ret cannot store a negative value roel kluin
2008-12-02 22:10 ` Andrew Morton [this message]
2008-12-03 4:29 ` Tom Zanussi
2008-12-03 4:37 ` Andrew Morton
2008-12-03 5:19 ` Tom Zanussi
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=20081202141042.3e0db395.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
--cc=zanussi@comcast.net \
--cc=zanussi@us.ibm.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