From: Dan Carpenter <dan.carpenter@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] trace: cleanup: make some types unsigned
Date: Fri, 7 Oct 2011 16:27:44 +0300 [thread overview]
Message-ID: <20111007132744.GC31424@elgon.mountain> (raw)
The problem here is that I'm trying to silence a static checker
warning. In replace_preds() we cap n_preds at MAX_FILTER_PRED but
we don't check for negative values. It can't actually be negative
values, but the static checkers get confused.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 256764e..7f4daff 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -790,7 +790,7 @@ static struct event_filter *__alloc_filter(void)
return filter;
}
-static int __alloc_preds(struct event_filter *filter, int n_preds)
+static int __alloc_preds(struct event_filter *filter, unsigned int n_preds)
{
struct filter_pred *pred;
int i;
@@ -1361,10 +1361,10 @@ static int check_preds(struct filter_parse_state *ps)
return 0;
}
-static int count_preds(struct filter_parse_state *ps)
+static unsigned int count_preds(struct filter_parse_state *ps)
{
struct postfix_elt *elt;
- int n_preds = 0;
+ unsigned int n_preds = 0;
list_for_each_entry(elt, &ps->postfix, list) {
if (elt->op == OP_NONE)
@@ -1601,7 +1601,7 @@ static int replace_preds(struct ftrace_event_call *call,
struct postfix_elt *elt;
struct pred_stack stack = { }; /* init to NULL */
int err;
- int n_preds = 0;
+ unsigned int n_preds = 0;
n_preds = count_preds(ps);
if (n_preds >= MAX_FILTER_PRED) {
next reply other threads:[~2011-10-07 13:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-07 13:27 Dan Carpenter [this message]
2011-10-07 13:38 ` [patch] trace: cleanup: make some types unsigned Steven Rostedt
2011-10-07 20:20 ` Dan Carpenter
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=20111007132744.GC31424@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=fweisbec@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/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