Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933070AbbLWQJf (ORCPT ); Wed, 23 Dec 2015 11:09:35 -0500 Received: from smtprelay0028.hostedemail.com ([216.40.44.28]:56133 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932781AbbLWQJd (ORCPT ); Wed, 23 Dec 2015 11:09:33 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3866:3867:3868:3870:3874:4321:5007:6119:6261:7875:9040:10004:10400:10848:10967:11026:11232:11658:11914:12296:12517:12519:12555:12740:13069:13311:13357:14096:14097:14659:21080:30012:30051:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: pin98_8d6820c59a94b X-Filterd-Recvd-Size: 2101 Date: Wed, 23 Dec 2015 11:09:30 -0500 From: Steven Rostedt To: Jerry Snitselaar Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: use seq_buf_used() in seq_buf_to_user() instead of len Message-ID: <20151223110930.27feb3a8@gandalf.local.home> In-Reply-To: <1447703848-2951-1-git-send-email-jsnitsel@redhat.com> References: <1447703848-2951-1-git-send-email-jsnitsel@redhat.com> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1474 Lines: 47 On Mon, 16 Nov 2015 12:57:28 -0700 Jerry Snitselaar wrote: > commit 5ac48378414d ("tracing: Use trace_seq_used() and seq_buf_used() > instead of len") changed the tracing code to use trace_seq_used() and > seq_buf_used() instead of using the seq_buf len directly to avoid > overflow issues, but missed a spot in seq_buf_to_user() that makes use > of s->len. > > Cleaned up the code a bit as well per suggestion of Steve Rostedt. > > Cc: "Steven Rostedt (Red Hat)" > Signed-off-by: Jerry Snitselaar I finally got around to applying this. Thanks! -- Steve > --- > lib/seq_buf.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/lib/seq_buf.c b/lib/seq_buf.c > index 5c94e10..cb18469 100644 > --- a/lib/seq_buf.c > +++ b/lib/seq_buf.c > @@ -306,10 +306,12 @@ int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, int cnt) > if (!cnt) > return 0; > > - if (s->len <= s->readpos) > + len = seq_buf_used(s); > + > + if (len <= s->readpos) > return -EBUSY; > > - len = seq_buf_used(s) - s->readpos; > + len -= s->readpos; > if (cnt > len) > cnt = len; > ret = copy_to_user(ubuf, s->buffer + s->readpos, cnt); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/