[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091201082901.4678.16688.sendpatchset@localhost.localdomain>
Date: Tue, 1 Dec 2009 03:26:02 -0500
From: Amerigo Wang <amwang@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: netdev@...r.kernel.org, Amerigo Wang <amwang@...hat.com>,
"David S. Miller" <davem@...emloft.net>
Subject: [Patch] net: fix an array index overflow
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@...hat.com>
Cc: David S. Miller <davem@...emloft.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)
--
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