[PATCH 2/7] x86/range: check range in update range

From: Yinghai Lu
Date: Fri Dec 11 2009 - 18:41:22 EST



fend off wrong range

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
kernel/range.c | 9 +++++++++
1 file changed, 9 insertions(+)

Index: linux-2.6/kernel/range.c
===================================================================
--- linux-2.6.orig/kernel/range.c
+++ linux-2.6/kernel/range.c
@@ -13,6 +13,9 @@

int add_range(struct range *range, int az, int nr_range, u64 start, u64 end)
{
+ if (start > end)
+ return nr_range;
+
/* Out of slots: */
if (nr_range >= az)
return nr_range;
@@ -30,6 +33,9 @@ int add_range_with_merge(struct range *r
{
int i;

+ if (start > end)
+ return nr_range;
+
/* Try to merge it with old one: */
for (i = 0; i < nr_range; i++) {
u64 final_start, final_end;
@@ -59,6 +65,9 @@ void subtract_range(struct range *range,
{
int i, j;

+ if (start > end)
+ return;
+
for (j = 0; j < az; j++) {
if (!range[j].end)
continue;

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