lkml.org 
[lkml]   [2009]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] tracing: clean up splice code
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


\
 
 \ /
  Last update: 2009-02-09 19:33    [W:1.038 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site