diff mbox series

tracing: Fix a NULL vs IS_ERR() bug in event_subsystem_dir()

Message ID ff641474-84e2-46a7-9d7a-62b251a1050c@moroto.mountain (mailing list archive)
State Accepted
Commit 5264a2f4bb3baf712e19f1f053caaa8d7d3afa2e
Headers show
Series tracing: Fix a NULL vs IS_ERR() bug in event_subsystem_dir() | expand

Commit Message

Dan Carpenter Oct. 20, 2023, 1:52 p.m. UTC
The eventfs_create_dir() function returns error pointers, it never returns
NULL.  Update the check to reflect that.

Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 kernel/trace/trace_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mukesh Ojha Oct. 23, 2023, 9:14 a.m. UTC | #1
On 10/20/2023 7:22 PM, Dan Carpenter wrote:
> The eventfs_create_dir() function returns error pointers, it never returns
> NULL.  Update the check to reflect that.
> 
> Fixes: 5790b1fb3d67 ("eventfs: Remove eventfs_file and just use eventfs_inode")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

LGTM, Thanks.

Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh

> ---
>   kernel/trace/trace_events.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index db46d2116500..f9e3e24d8796 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -2354,7 +2354,7 @@ event_subsystem_dir(struct trace_array *tr, const char *name,
>   		nr_entries = ARRAY_SIZE(system_entries);
>   
>   	ei = eventfs_create_dir(name, parent, system_entries, nr_entries, dir);
> -	if (!ei) {
> +	if (IS_ERR(ei)) {
>   		pr_warn("Failed to create system directory %s\n", name);
>   		__put_system(system);
>   		goto out_free;
diff mbox series

Patch

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index db46d2116500..f9e3e24d8796 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2354,7 +2354,7 @@  event_subsystem_dir(struct trace_array *tr, const char *name,
 		nr_entries = ARRAY_SIZE(system_entries);
 
 	ei = eventfs_create_dir(name, parent, system_entries, nr_entries, dir);
-	if (!ei) {
+	if (IS_ERR(ei)) {
 		pr_warn("Failed to create system directory %s\n", name);
 		__put_system(system);
 		goto out_free;