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, 20 Mar 2014 20:43:16 -0500
From:	Vince Bridgers <vbridgers2013@...il.com>
To:	netdev@...r.kernel.org
Cc:	vbridgers2013@...il.com
Subject: [PATCH net-next 2/3] Altera TSE: Correct typecast issue detected by kbuild test robot

This patch addresses a portable pointer arithmetic issue in the
original submission found by the kbuild test robot.

config: make ARCH=i386 allyesconfig

   altera_sgdma.c: In function 'sgdma_txphysaddr':
>> altera_sgdma.c:393:33: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
     dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
                                    ^
>> altera_sgdma.c:394:5: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
        (dma_addr_t)priv->tx_dma_desc);
        ^
   altera_sgdma.c: In function 'sgdma_rxphysaddr':
>> altera_sgdma.c:403:33: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
     dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
                                    ^
>> altera_sgdma.c:404:5: warning: cast from
>> pointer to integer of different size [-Wpointer-to-int-cast]
        (dma_addr_t)priv->rx_dma_desc);
        ^

Reported-by: kbuild test robot <fengguang.wu@...el.com>
Signed-off-by: Vince Bridgers <vbridgers2013@...il.com>
---
 drivers/net/ethernet/altera/altera_sgdma.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/altera/altera_sgdma.c b/drivers/net/ethernet/altera/altera_sgdma.c
index cbeee07..ebc4840 100644
--- a/drivers/net/ethernet/altera/altera_sgdma.c
+++ b/drivers/net/ethernet/altera/altera_sgdma.c
@@ -390,9 +390,8 @@ sgdma_txphysaddr(struct altera_tse_private *priv,
 		 struct sgdma_descrip *desc)
 {
 	dma_addr_t paddr = priv->txdescmem_busaddr;
-	dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
-				(dma_addr_t)priv->tx_dma_desc);
-	return paddr + offs;
+	uintptr_t offs = (uintptr_t)desc - (uintptr_t)priv->tx_dma_desc;
+	return (dma_addr_t)((uintptr_t)paddr + offs);
 }
 
 static dma_addr_t
@@ -400,9 +399,8 @@ sgdma_rxphysaddr(struct altera_tse_private *priv,
 		 struct sgdma_descrip *desc)
 {
 	dma_addr_t paddr = priv->rxdescmem_busaddr;
-	dma_addr_t offs = (dma_addr_t)((dma_addr_t)desc -
-				(dma_addr_t)priv->rx_dma_desc);
-	return paddr + offs;
+	uintptr_t offs = (uintptr_t)desc - (uintptr_t)priv->rx_dma_desc;
+	return (dma_addr_t)((uintptr_t)paddr + offs);
 }
 
 #define list_remove_head(list, entry, type, member)			\
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ