public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 3/3] tracing: clean up splice code
Date: Mon, 9 Feb 2009 20:37:54 +0200	[thread overview]
Message-ID: <20090209183754.GB5283@localhost> (raw)
In-Reply-To: <4990754C.7010301@cs.helsinki.fi>

On Mon, Feb 09, 2009 at 08:26:20PM +0200, Pekka Enberg wrote:
> Eduard - Gabriel Munteanu wrote:
>>> @@ -2573,45 +2607,25 @@ static ssize_t tracing_splice_read_pipe(struct 
>>> file *filp,
>>>  		ret = iter->trace->splice_read(iter, filp,
>>>  					       ppos, pipe, len, flags);
>>>  		if (ret)
>>> -			goto out;
>>> +			goto out_err;
>>>  	}
>>>   	ret = tracing_wait_pipe(filp);
>>>  	if (ret <= 0)
>>> -		goto out;
>>> +		goto out_err;
>>>   	if (!iter->ent && !find_next_entry_inc(iter)) {
>>>  		ret = -EFAULT;
>>> -		goto out;
>>> +		goto out_err;
>>>  	}
>>>   	/* Fill as many pages as possible. */
>>>  	for (i = 0, rem = len; i < PIPE_BUFFERS && rem; i++) {
>>>  		pages[i] = alloc_page(GFP_KERNEL);
>>> +		if (!pages[i])
>>> +			break;
>> I believe you should decrement 'i' before breaking, since we fill
>> spd.nr_pages just after the loop. In case the current page couldn't be
>> allocated, spd.nr_pages will be one too many (that is, 'i').
>
> But, but, if we fail for i == 1, for example, we want ->nr_pages == 1, no?
>
> 			Pekka

Sure, my bad. I even made the same assumption myself about the outer
'for' loop when I wrote it ('i' would end up last page + 1). The patch is
okay. :-)


	Eduard


  reply	other threads:[~2009-02-09 18:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09 17:28 [PATCH 0/3] git pull request for tip/tracing/ftrace Steven Rostedt
2009-02-09 17:28 ` [PATCH 1/3] tracing: splice support for tracing_pipe Steven Rostedt
2009-02-09 17:28 ` [PATCH 2/3] tracing: Move pipe waiting code out of tracing_read_pipe() Steven Rostedt
2009-02-09 17:33   ` Frederic Weisbecker
2009-02-09 17:28 ` [PATCH 3/3] tracing: clean up splice code Steven Rostedt
2009-02-09 18:25   ` Eduard - Gabriel Munteanu
2009-02-09 18:26     ` Pekka Enberg
2009-02-09 18:37       ` Eduard - Gabriel Munteanu [this message]
2009-02-09 18:43         ` Steven Rostedt
2009-02-10 13:00 ` [PATCH 0/3] git pull request for tip/tracing/ftrace Ingo Molnar
2009-02-10 14:08   ` Steven Rostedt

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=20090209183754.GB5283@localhost \
    --to=eduard.munteanu@linux360.ro \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    --cc=rostedt@goodmis.org \
    --cc=srostedt@redhat.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