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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 10 Apr 2019 06:11:17 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Steve Twiss <stwiss.opensource@...semi.com>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>
Cc:     "linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Support Opensource <Support.Opensource@...semi.com>
Subject: Re: [PATCH 12/22] watchdog: da9063_wdt: Use 'dev' instead of
 dereferencing it repeatedly

Hi Steve,

On 4/10/19 5:50 AM, Steve Twiss wrote:
> Hi Guenter,
> 
> On 08 April 2019 20:39, Guenter Roeck:
> 
>> Subject: [PATCH 12/22] watchdog: da9063_wdt: Use 'dev' instead of
>> dereferencing it repeatedly
>>
>> Introduce local variable 'struct device *dev' and use it instead of
>> dereferencing it repeatedly.
>>
>> The conversion was done automatically with coccinelle using the
>> following semantic patches. The semantic patches and the scripts
>> used to generate this commit log are available at
>> https://github.com/groeck/coccinelle-patches
>>
>> Cc: Support Opensource <support.opensource@...semi.com>
>> Signed-off-by: Guenter Roeck <linux@...ck-us.net>
>> ---
>>   drivers/watchdog/da9063_wdt.c | 11 ++++++-----
>>   1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
>> index 384dca16af8b..06eb9070203c 100644
>> --- a/drivers/watchdog/da9063_wdt.c
>> +++ b/drivers/watchdog/da9063_wdt.c
>> @@ -188,17 +188,18 @@ static const struct watchdog_ops
>> da9063_watchdog_ops = {
>>
>>   static int da9063_wdt_probe(struct platform_device *pdev)
>>   {
>> +	struct device *dev = &pdev->dev;
>>   	struct da9063 *da9063;
>>   	struct watchdog_device *wdd;
>>
>> -	if (!pdev->dev.parent)
>> +	if (!dev->parent)
>>   		return -EINVAL;
> 
> None of my previous Acked e-mails in this patch set considered whether the
> dev->parent was NULL. But this DA9063 driver does.
> 
> Logically, this is correct to check, but ... any thoughts?

The check is not really necessary. All da90xx drivers are instantiated from
mfd drivers and do provide a parent. Anyone changing that code or trying
to instantiate the drivers from some other place without providing a parent
really deserves the resulting crash (it would be a bug).

Either case, I don't think this warrants changing this driver to drop
the check, or changing the other drivers to add unnecessary checks
just to make the code consistent.

> Otherwise,
> 
> Acked-by: Steve Twiss <stwiss.opensource@...semi.com>
> 

Thanks,
Guenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ