From: Steven Rostedt <rostedt@goodmis.org>
To: Linux Trace Devel <linux-trace-devel@vger.kernel.org>
Cc: Ross Zwisler <zwisler@google.com>,
Stevie Alvarez <stevie.6strings@gmail.com>
Subject: [PATCH] traceeval: Fix traceeval_insert() macro for NULL vals
Date: Thu, 28 Sep 2023 05:15:11 -0400 [thread overview]
Message-ID: <20230928051511.074ab689@rorschach.local.home> (raw)
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
If the vals is NULL (which is valid), the traceeval_insert() macro calls
traceeval_insert_size() with sizeof(vals)/sizeof(vals[0]) to get the
number of vals in the array. But this does not make sense with a NULL
value. Check for NULL and if vals is NULL then pass in zero.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
include/traceeval-hist.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/traceeval-hist.h b/include/traceeval-hist.h
index eefa48d5d772..f6caed6a2a98 100644
--- a/include/traceeval-hist.h
+++ b/include/traceeval-hist.h
@@ -187,7 +187,7 @@ int traceeval_insert_size(struct traceeval *teval,
#define traceeval_insert(teval, keys, vals) \
traceeval_insert_size(teval, keys, TRACEEVAL_ARRAY_SIZE(keys), \
- vals, TRACEEVAL_ARRAY_SIZE(vals))
+ vals, vals ? TRACEEVAL_ARRAY_SIZE(vals) : 0)
int traceeval_remove_size(struct traceeval *teval,
const struct traceeval_data *keys, size_t nr_keys);
--
2.40.1
reply other threads:[~2023-09-28 9:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230928051511.074ab689@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=stevie.6strings@gmail.com \
--cc=zwisler@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).