netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch] net: fix an array index overflow
@ 2009-12-01  8:26 Amerigo Wang
  2009-12-01  8:48 ` Eric Dumazet
  2009-12-02 13:24 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Amerigo Wang @ 2009-12-01  8:26 UTC (permalink / raw)
  To: linux-kernel; +Cc: netdev, Amerigo Wang, David S. Miller


Don't use the address of an out-of-boundary element.

Maybe this is not harmful at runtime, but it is still
good to improve it.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: David S. Miller <davem@davemloft.net>

---
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 57737b8..2669361 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1586,7 +1586,7 @@ static int __init inet_init(void)
 #endif
 
 	/* Register the socket-side information for inet_create. */
-	for (r = &inetsw[0]; r < &inetsw[SOCK_MAX]; ++r)
+	for (r = &inetsw[0]; r <= &inetsw[SOCK_MAX-1]; ++r)
 		INIT_LIST_HEAD(r);
 
 	for (q = inetsw_array; q < &inetsw_array[INETSW_ARRAY_LEN]; ++q)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-03  8:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-01  8:26 [Patch] net: fix an array index overflow Amerigo Wang
2009-12-01  8:48 ` Eric Dumazet
2009-12-01  8:56   ` Cong Wang
2009-12-02 13:24 ` Dan Carpenter
2009-12-03  8:30   ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).