All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH net-next] fddi: defza: add missing pointer type cast
Date: Mon, 25 Oct 2021 19:09:28 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.2110251852540.58149@angie.orcam.me.uk> (raw)
In-Reply-To: <20211025160000.2803818-1-kuba@kernel.org>

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@orcam.me.uk>

  Maciej

  reply	other threads:[~2021-10-25 17:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 16:00 [PATCH net-next] fddi: defza: add missing pointer type cast Jakub Kicinski
2021-10-25 17:09 ` Maciej W. Rozycki [this message]
2021-10-25 17:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2110251852540.58149@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.