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]
Message-ID: <d74ccd1-116d-9450-5ee4-8d5074998872@linux-m68k.org>
Date:   Tue, 27 Jul 2021 19:50:39 +1000 (AEST)
From:   Finn Thain <fthain@...ux-m68k.org>
To:     Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, kernel@...gutronix.de,
        linux-m68k@...ts.linux-m68k.org
Subject: Re: [PATCH 1/5] nubus: Simplify check in remove callback

On Tue, 27 Jul 2021, Uwe Kleine-König wrote:

> The driver core only calls a remove callback when the device was
> successfully bound (aka probed) before. So dev->driver is never NULL.
> 

Are you sure dev->driver is non-NULL for the lifetime of the device?
A quick glance at device_reprobe() makes me wonder about that.

> Apart from that, the compiler might already assume dev->driver being
> non-NULL after to_nubus_driver(dev->driver) was called.
> 

I don't understand how a compiler can make that assumption. But then, I 
don't know why compilers do a lot of the things they do...

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
> ---
>  drivers/nubus/bus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index d9d04f27f89b..17fad660032c 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -33,7 +33,7 @@ static void nubus_device_remove(struct device *dev)
>  {
>  	struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
>  
> -	if (dev->driver && ndrv->remove)
> +	if (ndrv->remove)
>  		ndrv->remove(to_nubus_board(dev));
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ