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] [day] [month] [year] [list]
Message-ID: <425a47ad4de9f0f7bd00daf446566e59a9081c7e.camel@infradead.org>
Date:   Tue, 16 Feb 2021 17:00:26 +0100
From:   Amit Shah <amit@...radead.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        virtualization@...ts.linux-foundation.org
Cc:     Amit Shah <amit@...nel.org>, Arnd Bergmann <arnd@...db.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] virtio_console: remove pointless check for
 debugfs_create_dir()

On Tue, 2021-02-16 at 16:04 +0100, Greg Kroah-Hartman wrote:
> It is impossible for debugfs_create_dir() to return NULL, so checking
> for it gives people a false sense that they actually are doing something
> if an error occurs.  As there is no need to ever change kernel logic if
> debugfs is working "properly" or not, there is no need to check the
> return value of debugfs calls, so remove the checks here as they will
> never be triggered and are wrong.
> 
> Cc: Amit Shah <amit@...nel.org>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: virtualization@...ts.linux-foundation.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
>  drivers/char/virtio_console.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index 1836cc56e357..59dfd9c421a1 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -1456,18 +1456,15 @@ static int add_port(struct ports_device *portdev, u32 id)
>  	 */
>  	send_control_msg(port, VIRTIO_CONSOLE_PORT_READY, 1);
>  
> -	if (pdrvdata.debugfs_dir) {
> -		/*
> -		 * Finally, create the debugfs file that we can use to
> -		 * inspect a port's state at any time
> -		 */
> -		snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u",
> -			 port->portdev->vdev->index, id);
> -		port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
> -							 pdrvdata.debugfs_dir,
> -							 port,
> -							 &port_debugfs_fops);
> -	}
> +	/*
> +	 * Finally, create the debugfs file that we can use to
> +	 * inspect a port's state at any time
> +	 */
> +	snprintf(debugfs_name, sizeof(debugfs_name), "vport%up%u",
> +		 port->portdev->vdev->index, id);
> +	port->debugfs_file = debugfs_create_file(debugfs_name, 0444,
> +						 pdrvdata.debugfs_dir,
> +						 port, &port_debugfs_fops);
>  	return 0;
>  
>  free_inbufs:
> @@ -2244,8 +2241,6 @@ static int __init init(void)
>  	}
>  
>  	pdrvdata.debugfs_dir = debugfs_create_dir("virtio-ports", NULL);
> -	if (!pdrvdata.debugfs_dir)
> -		pr_warn("Error creating debugfs dir for virtio-ports\n");
>  	INIT_LIST_HEAD(&pdrvdata.consoles);
>  	INIT_LIST_HEAD(&pdrvdata.portdevs);
> 

Reviewed-by: Amit Shah <amit@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ