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:   Fri, 31 Jan 2020 17:17:50 +0530
From:   Radhey Shyam Pandey <radhey.shyam.pandey@...inx.com>
To:     davem@...emloft.net, netdev@...r.kernel.org
Cc:     michal.simek@...inx.com, anirudha.sarangi@...inx.com,
        john.linn@...inx.com, mchehab+samsung@...nel.org,
        gregkh@...uxfoundation.org, nicolas.ferre@...rochip.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Radhey Shyam Pandey <radhey.shyam.pandey@...inx.com>
Subject: [PATCH v3 -next 4/4] net: emaclite: Fix restricted cast warning of sparse

Explicitly cast xemaclite_readl return value when it's passed to ntohl.
Fixes below reported sparse warnings:

xilinx_emaclite.c:411:24: sparse: sparse: cast to restricted __be32
xilinx_emaclite.c:420:36: sparse: sparse: cast to restricted __be32

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@...inx.com>
Reported-by: kbuild test robot <lkp@...el.com>
---
 drivers/net/ethernet/xilinx/xilinx_emaclite.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index 96e9d21..3273d4f 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -408,7 +408,8 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data, int maxlen)
 
 	/* Get the protocol type of the ethernet frame that arrived
 	 */
-	proto_type = ((ntohl(xemaclite_readl(addr + XEL_HEADER_OFFSET +
+	proto_type = ((ntohl((__force __be32)xemaclite_readl(addr +
+			XEL_HEADER_OFFSET +
 			XEL_RXBUFF_OFFSET)) >> XEL_HEADER_SHIFT) &
 			XEL_RPLR_LENGTH_MASK);
 
@@ -417,7 +418,7 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data, int maxlen)
 	 */
 	if (proto_type > ETH_DATA_LEN) {
 		if (proto_type == ETH_P_IP) {
-			length = ((ntohl(xemaclite_readl(addr +
+			length = ((ntohl((__force __be32)xemaclite_readl(addr +
 					XEL_HEADER_IP_LENGTH_OFFSET +
 					XEL_RXBUFF_OFFSET)) >>
 					XEL_HEADER_SHIFT) &
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ