Bug 217128 - Improve exception handling in allocate_instance()
Summary: Improve exception handling in allocate_instance()
Status: RESOLVED CODE_FIX
Alias: None
Product: Tools
Classification: Unclassified
Component: Trace-cmd/Kernelshark (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Default virtual assignee for Trace-cmd and kernelshark
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-04 10:55 UTC by Markus Elfring
Modified: 2023-06-07 19:32 UTC (History)
1 user (show)

See Also:
Kernel Version: 6.2.2
Subsystem:
Regression: No
Bisected commit-id:


Attachments
change suggestion (725 bytes, patch)
2023-03-04 10:55 UTC, Markus Elfring
Details | Diff

Description Markus Elfring 2023-03-04 10:55:42 UTC
Created attachment 303838 [details]
change suggestion

Further data processing is performed after an allocation of a buffer instance succeeded.
The variable “instance” contains a valid pointer then.
But this pointer was checked again after the creation of a tracefs instance failed within the implementation of the function “allocate_instance”.
https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/tree/tracecmd/trace-record.c?id=0a68daed9f58e4429c0f1e7818f7cc0634873112#n360

* I suggest to remove the redundant check.
* May it be avoided to pass a null pointer to a call of the function “tracefs_instance_free”?
Comment 1 Steven Rostedt 2023-06-01 13:23:58 UTC
The code is fine as is.
Comment 2 Markus Elfring 2023-06-02 13:03:03 UTC
(In reply to Steven Rostedt from comment #1)
Your patch indicates other information, doesn't it?

trace-cmd record: Remove redundant check of instance in  allocate_instance()
https://lore.kernel.org/linux-trace-devel/20230602040123.3ce83b19@rorschach.local.home/
Comment 3 Steven Rostedt 2023-06-07 19:32:29 UTC
Fixed by: 22ad81e4818d ("trace-cmd record: Remove redundant check of instance in allocate_instance()")

Note You need to log in before you can comment on or make changes to this bug.