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  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:   Sat, 20 Jun 2020 18:43:38 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     davem@...emloft.net, netdev@...r.kernel.org
Cc:     UNGLinuxDriver@...rochip.com, andrew@...n.ch, f.fainelli@...il.com,
        vivien.didelot@...il.com, claudiu.manoil@....com,
        alexandru.marginean@....com, xiaoliang.yang_1@....com
Subject: [PATCH net-next 03/12] net: mscc: ocelot: access EtherType using __be16

From: Vladimir Oltean <vladimir.oltean@....com>

Get rid of sparse "cast to restricted __be16" warnings.

Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
---
 drivers/net/ethernet/mscc/ocelot_ace.c    | 4 ++--
 drivers/net/ethernet/mscc/ocelot_flower.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_ace.c b/drivers/net/ethernet/mscc/ocelot_ace.c
index 17b642e4d291..1dd881340067 100644
--- a/drivers/net/ethernet/mscc/ocelot_ace.c
+++ b/drivers/net/ethernet/mscc/ocelot_ace.c
@@ -746,8 +746,8 @@ static bool ocelot_ace_is_problematic_mac_etype(struct ocelot_ace_rule *ace)
 	if (ace->type != OCELOT_ACE_TYPE_ETYPE)
 		return false;
 
-	proto = ntohs(*(u16 *)ace->frame.etype.etype.value);
-	mask = ntohs(*(u16 *)ace->frame.etype.etype.mask);
+	proto = ntohs(*(__be16 *)ace->frame.etype.etype.value);
+	mask = ntohs(*(__be16 *)ace->frame.etype.etype.mask);
 
 	/* ETH_P_ALL match, so all protocols below are included */
 	if (mask == 0)
diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
index c90bafbd651f..99338d27aec0 100644
--- a/drivers/net/ethernet/mscc/ocelot_flower.c
+++ b/drivers/net/ethernet/mscc/ocelot_flower.c
@@ -176,8 +176,8 @@ static int ocelot_flower_parse(struct flow_cls_offload *f,
 		if (proto < ETH_P_802_3_MIN)
 			return -EOPNOTSUPP;
 		ace->type = OCELOT_ACE_TYPE_ETYPE;
-		*(u16 *)ace->frame.etype.etype.value = htons(proto);
-		*(u16 *)ace->frame.etype.etype.mask = 0xffff;
+		*(__be16 *)ace->frame.etype.etype.value = htons(proto);
+		*(__be16 *)ace->frame.etype.etype.mask = htons(0xffff);
 	}
 	/* else, a rule of type OCELOT_ACE_TYPE_ANY is implicitly added */
 
-- 
2.25.1

Powered by blists - more mailing lists