From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
akpm@osdl.org, Peter Zijlstra <peterz@infradead.org>,
Soeren Sandmann Pedersen <sandmann@redhat.com>,
Pekka Paalanen <pq@iki.fi>, Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 1/5] ftrace: simple clean ups
Date: Fri, 18 Apr 2008 16:05:39 -0400 [thread overview]
Message-ID: <20080418200849.968033091@goodmis.org> (raw)
In-Reply-To: 20080418200538.788522018@goodmis.org
[-- Attachment #1: ftrace-small-clean-ups.patch --]
[-- Type: text/plain, Size: 2120 bytes --]
Andrew Morton mentioned some clean ups that should be done to ftrace.
This patch does some of the simple clean ups.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/trace.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
Index: linux-sched-devel.git/kernel/trace/trace.c
===================================================================
--- linux-sched-devel.git.orig/kernel/trace/trace.c 2008-04-18 15:47:22.000000000 -0400
+++ linux-sched-devel.git/kernel/trace/trace.c 2008-04-18 15:47:40.000000000 -0400
@@ -36,8 +36,7 @@ unsigned long __read_mostly tracing_max_
unsigned long __read_mostly tracing_thresh;
/* dummy trace to disable tracing */
-static struct tracer no_tracer __read_mostly =
-{
+static struct tracer no_tracer __read_mostly = {
.name = "none",
};
@@ -1961,8 +1960,8 @@ tracing_iter_ctrl_write(struct file *fil
int neg = 0;
int i;
- if (cnt > 63)
- cnt = 63;
+ if (cnt >= sizeof(buf))
+ return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
@@ -2054,8 +2053,8 @@ tracing_ctrl_write(struct file *filp, co
long val;
char buf[64];
- if (cnt > 63)
- cnt = 63;
+ if (cnt >= sizeof(buf))
+ return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
@@ -2154,10 +2153,10 @@ tracing_max_lat_read(struct file *filp,
char buf[64];
int r;
- r = snprintf(buf, 64, "%ld\n",
+ r = snprintf(buf, sizeof(buf), "%ld\n",
*ptr == (unsigned long)-1 ? -1 : nsecs_to_usecs(*ptr));
- if (r > 64)
- r = 64;
+ if (r > sizeof(buf))
+ r = sizeof(buf);
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}
@@ -2169,8 +2168,8 @@ tracing_max_lat_write(struct file *filp,
long val;
char buf[64];
- if (cnt > 63)
- cnt = 63;
+ if (cnt >= sizeof(buf))
+ return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
@@ -2434,8 +2433,8 @@ tracing_entries_write(struct file *filp,
unsigned long val;
char buf[64];
- if (cnt > 63)
- cnt = 63;
+ if (cnt >= sizeof(buf))
+ return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt))
return -EFAULT;
--
next prev parent reply other threads:[~2008-04-18 20:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-18 20:05 [PATCH 0/5] ftrace update patches Steven Rostedt
2008-04-18 20:05 ` Steven Rostedt [this message]
2008-04-18 20:15 ` [PATCH 1/5] ftrace: simple clean ups Andrew Morton
2008-04-19 3:09 ` Steven Rostedt
2008-04-19 3:11 ` [PATCH 1/5 -v2] " Steven Rostedt
2008-04-18 20:05 ` [PATCH 2/5] ftrace: replace simple_strtoul with strict_strtoul Steven Rostedt
2008-04-18 20:05 ` [PATCH 3/5] ftrace: modulize the number of CPU buffers Steven Rostedt
2008-04-18 20:05 ` [PATCH 4/5] ftrace: limit trace entries Steven Rostedt
2008-04-18 20:19 ` Andrew Morton
2008-04-19 3:12 ` Steven Rostedt
2008-04-19 3:32 ` Andrew Morton
2008-04-19 3:17 ` [PATCH 4/5 -v2] " Steven Rostedt
2008-04-19 6:10 ` [PATCH 4/5] " Ingo Molnar
2008-04-18 20:05 ` [PATCH 5/5] ftrace: comment code Steven Rostedt
2008-04-19 6:11 ` [PATCH 0/5] ftrace update patches Ingo Molnar
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=20080418200849.968033091@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=pq@iki.fi \
--cc=sandmann@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.