Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754409Ab0AVJiP (ORCPT ); Fri, 22 Jan 2010 04:38:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754253Ab0AVJiC (ORCPT ); Fri, 22 Jan 2010 04:38:02 -0500 Received: from sca-es-mail-1.Sun.COM ([192.18.43.132]:53855 "EHLO sca-es-mail-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753118Ab0AVJZX (ORCPT ); Fri, 22 Jan 2010 04:25:23 -0500 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: TEXT/PLAIN Date: Fri, 22 Jan 2010 01:24:11 -0800 From: Yinghai Lu Subject: [PATCH 02/38] x86: check range in update range In-reply-to: <1264152287-13866-1-git-send-email-yinghai@kernel.org> To: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andrew Morton , Linus Torvalds Cc: Jesse Barnes , Christoph Lameter , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Yinghai Lu Message-id: <1264152287-13866-3-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.6.4.2 References: <1264152287-13866-1-git-send-email-yinghai@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1291 Lines: 53 fend off wrong range so later could use it with 32bit amd_bus/intel_bus, and it could have cap_resource. -v2: update comments Signed-off-by: Yinghai Lu --- kernel/range.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/kernel/range.c b/kernel/range.c index 46a10c8..71e0021 100644 --- a/kernel/range.c +++ b/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 *range, int az, int nr_range, { 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 az, u64 start, u64 end) { int i, j; + if (start > end) + return; + for (j = 0; j < az; j++) { if (!range[j].end) continue; -- 1.6.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/