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>] [day] [month] [year] [list]
Message-id: <108D4C89-3DB3-4042-9549-461BDB5E4302@me.com>
Date:	Tue, 02 Dec 2014 13:20:39 -0700
From:	Louis Langholtz <lou_langholtz@...com>
To:	linux-kernel@...r.kernel.org, yinghai@...nel.org,
	hpa@...ux.intel.com
Cc:	torvalds@...ux-foundation.org
Subject: [PATCH 3.18] kernel: avoid overflow in cmp_range()

Avoid overflow possibility.

Signed-off-by: Louis Langholtz <lou_langholtz@...com>
---
diff --git a/kernel/range.c b/kernel/range.c
index 322ea8e..06d9ee7 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -113,12 +113,16 @@ static int cmp_range(const void *x1, const void *x2)
{
       const struct range *r1 = x1;
       const struct range *r2 = x2;
-       s64 start1, start2;
+       u64 start1, start2;

       start1 = r1->start;
       start2 = r2->start;

-       return start1 - start2;
+       if (start1 < start2)
+               return -1;
+       if (start1 > start2)
+               return 1;
+       return 0;
}

int clean_sort_range(struct range *range, int az)
--
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