aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Petlan <mpetlan@redhat.com>2022-09-30 13:10:02 +0200
committerSteven Rostedt (Google) <rostedt@goodmis.org>2022-10-18 18:36:18 -0400
commit059563257cdc09bdd92a19819401a48a93cb81e4 (patch)
tree98a8da666e3eb3e3a3b7cbb11e63a45a912a6bde
parent64480d21046313042d32a96fdf329fb0ee9d58cf (diff)
downloadlibtraceevent-059563257cdc09bdd92a19819401a48a93cb81e4.tar.gz
libtraceevent: Fix Branch condition garbage value compiler warning
If *offset equals to zero, it is zero. If not equals to zero, set it to zero. In any case, it will be zero, so we can omit the condition and so get rid of the compiler warning: libtraceevent/src/event-parse.c:4064:7: warning[core.uninitialized.Branch]: Branch condition evaluates to a garbage value Instead, let's rather check the pointers for being NULL, in order to prevent another warning: libtraceevent/src/event-parse.c:4064:7: warning[core.NullDereference]: Dereference of null pointer (loaded from variable 'offset') Link: https://lore.kernel.org/linux-trace-devel/20220930111002.6107-4-mpetlan@redhat.com Signed-off-by: Michael Petlan <mpetlan@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--src/event-parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/event-parse.c b/src/event-parse.c
index b887746..a0d7da5 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -4073,9 +4073,9 @@ static inline void dynamic_offset_field(struct tep_handle *tep,
{
/* Test for overflow */
if (field->offset + field->size > size) {
- if (*offset)
+ if (offset)
*offset = 0;
- if (*len)
+ if (len)
*len = 0;
return;
}