lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 May 2023 11:53:40 +0100
From:   Mauro Carvalho Chehab <mchehab@...nel.org>
To:     Osama Muhammad <osmtendev@...il.com>
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] smsdvb-debugfs.c: Fix error checking for
 debugfs_create_file

Em Wed, 24 May 2023 21:42:10 +0500
Osama Muhammad <osmtendev@...il.com> escreveu:

> This patch fixes the error checking in smsdvb-debugfs.c in
> debugfs_create_file. The correct way to check if an error occurred
> is using 'IS_ERR_OR_NULL' inline function.
> 
> Signed-off-by: Osama Muhammad <osmtendev@...il.com>
> ---
>  drivers/media/common/siano/smsdvb-debugfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c
> index 8916bb644756..0f8750d7993c 100644
> --- a/drivers/media/common/siano/smsdvb-debugfs.c
> +++ b/drivers/media/common/siano/smsdvb-debugfs.c
> @@ -469,7 +469,7 @@ int smsdvb_debugfs_create(struct smsdvb_client_t *client)
>  
>  	d = debugfs_create_file("stats", S_IRUGO | S_IWUSR, client->debugfs,
>  				client, &debugfs_stats_ops);
> -	if (!d) {
> +	if (IS_ERR_OR_NULL(d)) {
>  		debugfs_remove(client->debugfs);
>  		return -ENOMEM;

if IS_ERR, it is probably better to return PTR_ERR(d).

So, please change it accordingly, returning -ENOMEM only on NULL, e. g.
something like (untested):

	if (IS_ERR_OR_NULL(d)) {
 		debugfs_remove(client->debugfs);
		if (!d)
	  		return -ENOMEM;
		return PTR_ERR(d);
	}

Regards,
Mauro

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ