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: <20190527035653.7552-1-yangbo.lu@nxp.com>
Date:   Mon, 27 May 2019 03:55:20 +0000
From:   "Y.b. Lu" <yangbo.lu@....com>
To:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        David Miller <davem@...emloft.net>,
        Claudiu Manoil <claudiu.manoil@....com>
CC:     "Y.b. Lu" <yangbo.lu@....com>
Subject: [PATCH] enetc: fix le32/le16 degrading to integer warnings

Fix blow sparse warning introduced by a previous patch.
- restricted __le32 degrades to integer
- restricted __le16 degrades to integer

Fixes: d39823121911 ("enetc: add hardware timestamping support")
Signed-off-by: Yangbo Lu <yangbo.lu@....com>
---
 drivers/net/ethernet/freescale/enetc/enetc.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c
index d2ace299bed0..79bbc86abe77 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc.c
@@ -307,13 +307,14 @@ static int enetc_bd_ready_count(struct enetc_bdr *tx_ring, int ci)
 static void enetc_get_tx_tstamp(struct enetc_hw *hw, union enetc_tx_bd *txbd,
 				u64 *tstamp)
 {
-	u32 lo, hi;
+	u32 lo, hi, tstamp_lo;
 
 	lo = enetc_rd(hw, ENETC_SICTR0);
 	hi = enetc_rd(hw, ENETC_SICTR1);
-	if (lo <= txbd->wb.tstamp)
+	tstamp_lo = le32_to_cpu(txbd->wb.tstamp);
+	if (lo <= tstamp_lo)
 		hi -= 1;
-	*tstamp = (u64)hi << 32 | txbd->wb.tstamp;
+	*tstamp = (u64)hi << 32 | tstamp_lo;
 }
 
 static void enetc_tstamp_tx(struct sk_buff *skb, u64 tstamp)
@@ -483,16 +484,17 @@ static void enetc_get_rx_tstamp(struct net_device *ndev,
 	struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb);
 	struct enetc_ndev_priv *priv = netdev_priv(ndev);
 	struct enetc_hw *hw = &priv->si->hw;
-	u32 lo, hi;
+	u32 lo, hi, tstamp_lo;
 	u64 tstamp;
 
-	if (rxbd->r.flags & ENETC_RXBD_FLAG_TSTMP) {
+	if (le16_to_cpu(rxbd->r.flags) & ENETC_RXBD_FLAG_TSTMP) {
 		lo = enetc_rd(hw, ENETC_SICTR0);
 		hi = enetc_rd(hw, ENETC_SICTR1);
-		if (lo <= rxbd->r.tstamp)
+		tstamp_lo = le32_to_cpu(rxbd->r.tstamp);
+		if (lo <= tstamp_lo)
 			hi -= 1;
 
-		tstamp = (u64)hi << 32 | rxbd->r.tstamp;
+		tstamp = (u64)hi << 32 | tstamp_lo;
 		memset(shhwtstamps, 0, sizeof(*shhwtstamps));
 		shhwtstamps->hwtstamp = ns_to_ktime(tstamp);
 	}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ