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:   Thu, 29 Mar 2018 23:03:10 -0700
From:   Quytelda Kahja <quytelda@...alin.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Greg KH <gregkh@...uxfoundation.org>, wsa@...-dreams.de,
        driverdev-devel@...uxdriverproject.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/9] staging: ks7010: Replace manual array copy with ether_addr_copy().

If we just want to have the address field full of zeros during the
driver probe, is there a reason we should zero it explicitly here?
When the 'struct net_device' is first allocated using
alloc_etherdev(), the dev_addr field is explicitly set to zeros (in
the subfunction dev_addr_init() in net/core/dev_addr_lists.c), so it
should be zeroed already at this point in the code.

Thank you,
Quytelda Kahja

On Wed, Mar 28, 2018 at 11:02 PM, Joe Perches <joe@...ches.com> wrote:
> On Wed, 2018-03-28 at 22:51 -0700, Quytelda Kahja wrote:
>> Copying the dummy HW address into the struct net_device doesn't need
>> to be done byte by byte; use ether_addr_copy() instead.
>> Additionally, dev->dev_addr is not eight bytes long.
>> ether_setup() sets the dev->addr_len to ETH_ALEN (defined as 6)
>> in the net core code.
> []
>> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> []
>> @@ -2900,15 +2900,7 @@ int ks_wlan_net_start(struct net_device *dev)
>>       timer_setup(&update_phyinfo_timer, ks_wlan_update_phyinfo_timeout, 0);
>>
>>       /* dummy address set */
>> -     memcpy(priv->eth_addr, dummy_addr, ETH_ALEN);
>
> why remove the copy of dummy_addr into priv->eth_addr ?
>
> Also, dummy_addr could be removed and eth_zero_addr()
> used instead.
>
>> -     dev->dev_addr[0] = priv->eth_addr[0];
>> -     dev->dev_addr[1] = priv->eth_addr[1];
>> -     dev->dev_addr[2] = priv->eth_addr[2];
>> -     dev->dev_addr[3] = priv->eth_addr[3];
>> -     dev->dev_addr[4] = priv->eth_addr[4];
>> -     dev->dev_addr[5] = priv->eth_addr[5];
>> -     dev->dev_addr[6] = 0x00;
>> -     dev->dev_addr[7] = 0x00;
>> +     ether_addr_copy(dev->dev_addr, priv->eth_addr);
>
> Perhaps
>
>         eth_zero_addr(priv->eth_addr);
>         eth_zero_addr(dev->dev_addr);
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ