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: <20140410213029.24916.93892.stgit@bhelgaas-glaptop.roam.corp.google.com>
Date:	Thu, 10 Apr 2014 15:30:29 -0600
From:	Bjorn Helgaas <bhelgaas@...gle.com>
To:	"David S. Miller" <davem@...emloft.net>
Cc:	Florian Fainelli <f.fainelli@...il.com>,
	Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
	netdev@...r.kernel.org, James Morris <jmorris@...ei.org>,
	linux-kernel@...r.kernel.org,
	David Laight <David.Laight@...lab.com>,
	Alexey Kuznetsov <kuznet@....inr.ac.ru>,
	Patrick McHardy <kaber@...sh.net>
Subject: [PATCH] tcp: fix compiler array bounds warning on selective_acks[]

With -Werror=array-bounds, gcc v4.8.x warns that in tcp_sack_remove(), a
selective_acks[] "array subscript is above array bounds".

I don't understand how gcc figures this out, or why we don't see similar
problems many other places, but this is the only fix I can figure out.

Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
 net/ipv4/tcp_input.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 65cf90e063d5..65133b108236 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -4047,7 +4047,8 @@ static void tcp_sack_remove(struct tcp_sock *tp)
 
 			/* Zap this SACK, by moving forward any other SACKS. */
 			for (i = this_sack+1; i < num_sacks; i++)
-				tp->selective_acks[i-1] = tp->selective_acks[i];
+				if (i < ARRAY_SIZE(tp->selective_acks))
+					tp->selective_acks[i-1] = tp->selective_acks[i];
 			num_sacks--;
 			continue;
 		}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ