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: <28dd699b-3013-c42c-07d5-1117d7ab3622@posteo.de>
Date:   Fri, 22 Jun 2018 14:48:43 +0200
From:   Michael Straube <michael.straube@...teo.de>
To:     Dan Carpenter <dan.carpenter@...cle.com>,
        Joe Perches <joe@...ches.com>
Cc:     gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs: do not use assignment in if condition

On 06/22/18 12:57, Dan Carpenter wrote:
> On Fri, Jun 22, 2018 at 03:54:22AM -0700, Joe Perches wrote:
>> On Fri, 2018-06-22 at 13:40 +0300, Dan Carpenter wrote:
>>> On Thu, Jun 21, 2018 at 08:22:30PM +0200, Michael Straube wrote:
>>>> Fix checkpatch error 'do not use assignment in if condition'.
>> []
>>>> diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
>>>> index e55895632921..87a4ced41028 100644
>>>> --- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
>>>> +++ b/
>>>> @@ -1181,9 +1181,8 @@ void rtw_macaddr_cfg(struct device *dev, u8 *mac_addr)
>>>>   	     (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
>>>>   	    ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
>>>>   	     (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00))) {
>>
>> Should also use is_broadcast_ether_addr and is_zero_ether_addr
>>
>>>> -		if (np &&
>>>> -		    (addr = of_get_property(np, "local-mac-address", &len)) &&
>>>> -		    len == ETH_ALEN) {
>>>> +		addr = of_get_property(np, "local-mac-address", &len);
>>>> +		if (np && addr && len == ETH_ALEN) {
>>>
>>> You can remove the "np" check.
>>>
>>> 		if (addr && len == ETH_ALEN) {
>>
>> It looks more like the rewrite is incorrect
>> as np is tested before of_get_property
>>
> 
> That's what I was worried about too, but if "np" is NULL then
> of_get_property() just returns NULL so it's fine.

So it should be this?

         if (((mac[0] == 0xff) && (mac[1] == 0xff) && (mac[2] == 0xff) &&
              (mac[3] == 0xff) && (mac[4] == 0xff) && (mac[5] == 0xff)) ||
             ((mac[0] == 0x00) && (mac[1] == 0x00) && (mac[2] == 0x00) &&
              (mac[3] == 0x00) && (mac[4] == 0x00) && (mac[5] == 0x00)) &&
             (is_broadcast_ether_addr(mac) || is_zero_ether_addr(mac))) {
                 addr = of_get_property(np, "local-mac-address", &len);
                 if (addr && len == ETH_ALEN) {
                         memcpy(mac_addr, addr, ETH_ALEN);
                 } else {
                         mac[0] = 0x00;
                         ...
		}
	}

If yes, I'm not sure how to proceed as these are the very first patches I send.
Should I send a v2 patch with both changes or just a v2 with "np" removed and
another one for adding 'is_broadcast_ether_addr' and 'is_zero_ether_addr' checks?

Regards,
Michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ