Bug 217053
Summary: | warning: argument 2 null where non-null expected [-Wnonnull] | ||
---|---|---|---|
Product: | Tracing/Profiling | Reporter: | sander44 (ionut_n2001) |
Component: | Ftrace | Assignee: | Steven Rostedt (rostedt) |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | P1 | ||
Hardware: | AMD | ||
OS: | Linux | ||
Kernel Version: | 6.1.12 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | Check for NULL field_name in __synth_event_add_val() |
Description
sander44
2023-02-18 15:31:26 UTC
Created attachment 303749 [details]
Check for NULL field_name in __synth_event_add_val()
Can you test this to see if it fixes the issue for you?
Hi Steven, I will try to apply your change. but these days I'm busy. I will return with a feedback in the following days. Thanks. According to Tom Zanussi, it can never be NULL. https://lore.kernel.org/lkml/06c77bca76cd5679c8cd459480621b7db21f3a7b.camel@kernel.org/ As the code has: if (field_name) { if (trace_state->add_next) { ret = -EINVAL; goto out; } trace_state->add_name = true; } else { if (trace_state->add_name) { ret = -EINVAL; goto out; <<--- HERE If field_name is NULL and trace_state->add_name is true, it exits the function. } trace_state->add_next = true; } if (trace_state->disabled) goto out; event = trace_state->event; if (trace_state->add_name) { trace_state->add_name must be true to get here. for (i = 0; i < event->n_fields; i++) { field = event->fields[i]; if (strcmp(field->name, field_name) == 0) How can field_name be NULL then? break; } I'm closing this as not a bug, because it seems to be a bug in gcc's warning. Feel free to reopen it if you can show this is incorrect. |