All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: linux-trace-devel@vger.kernel.org,
	Tzvetomir Stoyanov <tz.stoyanov@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Ian Rogers <irogers@google.com>
Subject: [PATCH] Initialize field_size prior to use
Date: Wed, 28 Sep 2022 14:09:31 -0700	[thread overview]
Message-ID: <20220928210931.1803799-1-irogers@google.com> (raw)

Building with CC=clang yields:

```
  COMPILE FPIC       event-parse.o
event-parse.c:4313:17: warning: variable 'field_size' is uninitialized when used here [-Wuninitialized]
                                           offset, field_size)) {
                                                   ^~~~~~~~~~
event-parse.c:4108:25: note: initialize the variable 'field_size' to silence this warning
        unsigned int field_size;
                               ^
                                = 0
1 warning generated.
```

dynamic_offset_field will compute the length of the field and so use
that to give field_size a legitimate value.

Signed-off-by: Ian Rogers <irogers@google.com>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/event-parse.c b/src/event-parse.c
index 980e980..b3e0ea7 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -4308,7 +4308,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
 	case TEP_PRINT_DYNAMIC_ARRAY:
 		/* Without [], we pass the address to the dynamic data */
 		dynamic_offset_field(tep, arg->dynarray.field, data, size,
-				     &offset, NULL);
+				     &offset, &field_size);
 		if (check_data_offset_size(event, arg->field.name, size,
 					   offset, field_size)) {
 			val = (unsigned long)data;
-- 
2.38.0.rc1.362.ged0d419d3c-goog


             reply	other threads:[~2022-09-28 21:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 21:09 Ian Rogers [this message]
2022-09-28 21:26 ` [PATCH] Initialize field_size prior to use Steven Rostedt

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=20220928210931.1803799-1-irogers@google.com \
    --to=irogers@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tz.stoyanov@gmail.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.