lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0902091342000.14528@gandalf.stny.rr.com>
Date:	Mon, 9 Feb 2009 13:43:04 -0500 (EST)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Eduard - Gabriel Munteanu <eduard.munteanu@...ux360.ro>
cc:	Pekka Enberg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Steven Rostedt <srostedt@...hat.com>
Subject: Re: [PATCH 3/3] tracing: clean up splice code


On Mon, 9 Feb 2009, Eduard - Gabriel Munteanu wrote:

> 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. :-)

Heh, I was just about to say, if this is wrong then so is the if below it 
;-)


               pages[i] = alloc_page(GFP_KERNEL);
                if (!pages[i])
                        break;

                rem = tracing_fill_pipe_page(pages[i], rem, iter);

                /* Copy the data into the page, so we can start over. */
                ret = trace_seq_to_buffer(&iter->seq,
                                          page_address(pages[i]),
                                          iter->seq.len);
                if (ret < 0) {
                        __free_page(pages[i]);

Same 'i'.
                        break;
                }


Thanks Eduard!

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ