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: <alpine.DEB.2.21.2110251852540.58149@angie.orcam.me.uk>
Date:   Mon, 25 Oct 2021 19:09:28 +0200 (CEST)
From:   "Maciej W. Rozycki" <macro@...am.me.uk>
To:     Jakub Kicinski <kuba@...nel.org>
cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH net-next] fddi: defza: add missing pointer type cast

On Mon, 25 Oct 2021, Jakub Kicinski wrote:

> hw_addr is a uint AKA unsigned int. dev_addr_set() takes
> a u8 *.

 Hmm, that's for alignment purposes to keep accessors simple (and somewhat 
faster) as hardware ignores byte lane enables, though having had a look at 
`fza_reads' something seems fishy to me here and I think `hw_addr' should 
be `u64' rather than `uint[2]'.  I'll have to double-check alignments 
throughout `struct fza_cmd_init' too and possibly elsewhere.  Unaligned 
accesses will trap and will be emulated even in the kernel mode (we need 
that for some IP packet header processing too), but obviously performance 
will suck.

> diff --git a/drivers/net/fddi/defza.c b/drivers/net/fddi/defza.c
> index 3a6b08eb5e1b..f5c25acaa577 100644
> --- a/drivers/net/fddi/defza.c
> +++ b/drivers/net/fddi/defza.c
> @@ -1380,7 +1380,7 @@ static int fza_probe(struct device *bdev)
>  		goto err_out_irq;
>  
>  	fza_reads(&init->hw_addr, &hw_addr, sizeof(hw_addr));
> -	dev_addr_set(dev, &hw_addr);
> +	dev_addr_set(dev, (u8 *)&hw_addr);

 A union would be cleaner rather than having the type punned, but let's 
keep it like you proposed for now.

Acked-by: Maciej W. Rozycki <macro@...am.me.uk>

  Maciej

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ