Skip to contentSkip to conversation

fddi: defza: add missing pointer type cast

PATCH Applied Jakub Kicinski 3 participants 3 messages Oct 25, 2021

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 fddi: defza: add missing pointer type cast

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

drivers/net/fddi/defza.c:1383:27: error: passing argument 2 of 'dev_addr_set' from incompatible pointer type [-Werror=incompatible-pointer-types]

Fixes 1e9258c389ee ("fddi: defxx,defza: use dev_addr_set()")
---
 drivers/net/fddi/defza.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/fddi/defza.c +1 -1
index 3a6b08eb5e1b..f5c25acaa577 100644
@@ -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);
 
 	fza_reads(&init->rom_rev, &rom_rev, sizeof(rom_rev));
 	fza_reads(&init->fw_rev, &fw_rev, sizeof(fw_rev));
Signature · 1 line
2.31.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Jakub Kicinski

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.

drivers/net/fddi/defza.c static int fza_probe(struct device *bdev) · line 1383

Quoted 10 lines
drivers/net/fddi/defza.c +1 -1
index 3a6b08eb5e1b..f5c25acaa577 100644
@@ -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.

Maciej

#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Mon, 25 Oct 2021 09:00:00 -0700 you wrote:

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

drivers/net/fddi/defza.c:1383:27: error: passing argument 2 of 'dev_addr_set' from incompatible pointer type [-Werror=incompatible-pointer-types]

Fixes 1e9258c389ee ("fddi: defxx,defza: use dev_addr_set()")

[...]

Here is the summary with links:
- [net-next] fddi: defza: add missing pointer type cast

    https://git.kernel.org/netdev/net-next/c/a0c8c3372b41

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html