All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Fwd: [PATCH v2] kernel/resource.c: use signed length comparing instead of position comparing
Date: Mon, 04 Nov 2013 14:05:36 +0800	[thread overview]
Message-ID: <52773930.2020808@asianux.com> (raw)
In-Reply-To: <52770EFA.5060809@asianux.com>


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



           reply	other threads:[~2013-11-04  6:06 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <52770EFA.5060809@asianux.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52773930.2020808@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.