linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: [PATCH v2] kernel/resource.c: use signed length comparing instead of position comparing
       [not found] <52770EFA.5060809@asianux.com>
@ 2013-11-04  6:05 ` Chen Gang
  0 siblings, 0 replies; only message in thread
From: Chen Gang @ 2013-11-04  6:05 UTC (permalink / raw)
  To: linux-kernel


Sorry, forgot to cc linux-kernel.


-------- Original Message --------
Subject: [PATCH v2] kernel/resource.c: use signed length comparing instead of position comparing
Date: Mon, 04 Nov 2013 11:05:30 +0800
From: Chen Gang <gang.chen@asianux.com>
To: Toshi Kani <toshi.kani@hp.com>,  "isimatu.yasuaki@jp.fujitsu.com" <isimatu.yasuaki@jp.fujitsu.com>, gong.chen@linux.intel.com, haokexin@gmail.com
CC: Andrew Morton <akpm@linux-foundation.org>

Theoretically, "addr + size" may be overflow (e.g. equal 0), so use
signed length comparing instead of position comparing.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 kernel/resource.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 3f285dc..0783733 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -1335,7 +1335,7 @@ int iomem_is_exclusive(u64 addr)
 		 * We can probably skip the resources without
 		 * IORESOURCE_IO attribute?
 		 */
-		if (p->start >= addr + size)
+		if ((s64)(p->start - addr) >= size)
 			break;
 		if (p->end < addr)
 			continue;
-- 
1.7.7.6



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-04  6:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <52770EFA.5060809@asianux.com>
2013-11-04  6:05 ` Fwd: [PATCH v2] kernel/resource.c: use signed length comparing instead of position comparing Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).