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]
Message-Id: <20230622130507.606713-2-ben.dooks@codethink.co.uk>
Date: Thu, 22 Jun 2023 14:05:05 +0100
From: Ben Dooks <ben.dooks@...ethink.co.uk>
To: netdev@...r.kernel.org,
	pabeni@...hat.com,
	kuba@...nel.org,
	edumazet@...gle.com,
	davem@...emloft.net
Cc: linux-kernel@...r.kernel.org,
	claudiu.beznea@...rochip.com,
	nicolas.ferre@...rochip.com,
	Ben Dooks <ben.dooks@...ethink.co.uk>
Subject: [PATCH 1/3] net: macb: check constant to define and fix __be32 warnings

The checks on ipv4 addresses in the filtering code check against
a constant of 0xFFFFFFFF, so replace it with MACB_IPV4_MASK and
then make sure it is of __be32 type to avoid the following
sparse warnigns:

drivers/net/ethernet/cadence/macb_main.c:3448:39: warning: restricted __be32 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3453:39: warning: restricted __be32 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3483:20: warning: restricted __be32 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3497:20: warning: restricted __be32 degrades to integer

Signed-off-by: Ben Dooks <ben.dooks@...ethink.co.uk>
---
 drivers/net/ethernet/cadence/macb_main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index f20ec0d5260b..538d4c7e023b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3418,6 +3418,8 @@ static int macb_get_ts_info(struct net_device *netdev,
 	return ethtool_op_get_ts_info(netdev, info);
 }
 
+#define MACB_IPV4_MASK htonl(0xFFFFFFFF)
+
 static void gem_enable_flow_filters(struct macb *bp, bool enable)
 {
 	struct net_device *netdev = bp->dev;
@@ -3445,12 +3447,12 @@ static void gem_enable_flow_filters(struct macb *bp, bool enable)
 		/* only enable fields with no masking */
 		tp4sp_m = &(fs->m_u.tcp_ip4_spec);
 
-		if (enable && (tp4sp_m->ip4src == 0xFFFFFFFF))
+		if (enable && (tp4sp_m->ip4src == MACB_IPV4_MASK))
 			t2_scr = GEM_BFINS(CMPAEN, 1, t2_scr);
 		else
 			t2_scr = GEM_BFINS(CMPAEN, 0, t2_scr);
 
-		if (enable && (tp4sp_m->ip4dst == 0xFFFFFFFF))
+		if (enable && (tp4sp_m->ip4dst == MACB_IPV4_MASK))
 			t2_scr = GEM_BFINS(CMPBEN, 1, t2_scr);
 		else
 			t2_scr = GEM_BFINS(CMPBEN, 0, t2_scr);
@@ -3480,7 +3482,7 @@ static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs)
 	tp4sp_m = &(fs->m_u.tcp_ip4_spec);
 
 	/* ignore field if any masking set */
-	if (tp4sp_m->ip4src == 0xFFFFFFFF) {
+	if (tp4sp_m->ip4src == MACB_IPV4_MASK) {
 		/* 1st compare reg - IP source address */
 		w0 = 0;
 		w1 = 0;
@@ -3494,7 +3496,7 @@ static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs)
 	}
 
 	/* ignore field if any masking set */
-	if (tp4sp_m->ip4dst == 0xFFFFFFFF) {
+	if (tp4sp_m->ip4dst == MACB_IPV4_MASK) {
 		/* 2nd compare reg - IP destination address */
 		w0 = 0;
 		w1 = 0;
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ