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-next>] [day] [month] [year] [list]
Message-Id: <20211130063939.6929-1-rdunlap@infradead.org>
Date:   Mon, 29 Nov 2021 22:39:39 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     netdev@...r.kernel.org
Cc:     Randy Dunlap <rdunlap@...radead.org>,
        Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
        Chris Zankel <chris@...kel.net>,
        Max Filippov <jcmvbkbc@...il.com>,
        linux-xtensa@...ux-xtensa.org,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH 1/2 -net] natsemi: xtensa: allow writing to const dev_addr array

Let the compiler know that it's ok to write to this const field.

Fixes these build errors:

../drivers/net/ethernet/natsemi/xtsonic.c: In function 'sonic_probe1':
../drivers/net/ethernet/natsemi/xtsonic.c:166:36: error: assignment of read-only location '*(dev->dev_addr + (sizetype)(i * 2))'
  166 |                 dev->dev_addr[i*2] = val;
../drivers/net/ethernet/natsemi/xtsonic.c:167:38: error: assignment of read-only location '*(dev->dev_addr + ((sizetype)(i * 2) + 1))'
  167 |                 dev->dev_addr[i*2+1] = val >> 8;

Fixes: 74f2a5f0ef64 ("xtensa: Add support for the Sonic Ethernet device for the XT2000 board.")
Signed-off-by: Randy Dunlap <rdunlap@...radead.org>
Cc: Thomas Bogendoerfer <tsbogend@...ha.franken.de>
Cc: Chris Zankel <chris@...kel.net>
Cc: Max Filippov <jcmvbkbc@...il.com>
Cc: linux-xtensa@...ux-xtensa.org
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Jakub Kicinski <kuba@...nel.org>
---
 drivers/net/ethernet/natsemi/xtsonic.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- linux-next-20211129.orig/drivers/net/ethernet/natsemi/xtsonic.c
+++ linux-next-20211129/drivers/net/ethernet/natsemi/xtsonic.c
@@ -125,6 +125,7 @@ static int __init sonic_probe1(struct ne
 	unsigned int silicon_revision;
 	struct sonic_local *lp = netdev_priv(dev);
 	unsigned int base_addr = dev->base_addr;
+	unsigned char *devadr;
 	int i;
 	int err = 0;
 
@@ -161,10 +162,10 @@ static int __init sonic_probe1(struct ne
 	SONIC_WRITE(SONIC_CMD,SONIC_CR_RST);
 	SONIC_WRITE(SONIC_CEP,0);
 
-	for (i=0; i<3; i++) {
+	for (i=0, devadr = (unsigned char *)dev->dev_addr; i<3; i++) {
 		unsigned int val = SONIC_READ(SONIC_CAP0-i);
-		dev->dev_addr[i*2] = val;
-		dev->dev_addr[i*2+1] = val >> 8;
+		devadr[i*2] = val;
+		devadr[i*2+1] = val >> 8;
 	}
 
 	lp->dma_bitmode = SONIC_BITMODE32;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ