[patch] netfilter: prevent harmless integer overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This overflow is harmless because a few lines later we check:

	if (num_counters != t->private->nentries) {

But it still upsets the static checkers.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
index 3d110c4..141350e 100644
--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1278,6 +1278,8 @@ static int do_update_counters(struct net *net, const char *name,
 
 	if (num_counters == 0)
 		return -EINVAL;
+	if (num_counters > INT_MAX / sizeof(*tmp))
+		return -ENOMEM;
 
 	tmp = vmalloc(num_counters * sizeof(*tmp));
 	if (!tmp)
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux