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-next>] [day] [month] [year] [list]
Date:   Sat, 30 Mar 2019 21:42:41 +0000
From:   Colin King <>
To:     Andrew Lunn <>,
        Vivien Didelot <>,
        Florian Fainelli <>,
        "David S . Miller" <>,
Subject: [PATCH] net: dsa: fix negative loop bound error on for loop

From: Colin Ian King <>

Currently the for-loop using an unsigned int for the loop counter
which is problematic when comparing it to the signed int count
This is an issue because if the signed int is negative then
the negative loop bound is implicitly cast to an unsigned int on
the comparison to loop counter i and will yield a very large value,
eventually causing an error when memmove/memcpy'ing outside the
allocated region pointed to by ndata.

Fix this by simply making the loop counter i a signed int;

Fixes: f2f2356685bc ("net: dsa: move master ethtool code")
Signed-off-by: Colin Ian King <>
 net/dsa/master.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/dsa/master.c b/net/dsa/master.c
index c58f33931be1..1b659647a303 100644
--- a/net/dsa/master.c
+++ b/net/dsa/master.c
@@ -87,8 +87,7 @@ static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset,
 	struct dsa_switch *ds = cpu_dp->ds;
 	int port = cpu_dp->index;
 	int len = ETH_GSTRING_LEN;
-	int mcount = 0, count;
-	unsigned int i;
+	int mcount = 0, count, i;
 	uint8_t pfx[4];
 	uint8_t *ndata;

Powered by blists - more mailing lists