From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-sh@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Mundt <lethal@linux-sh.org>
Subject: [patch] sh: off by one BUG_ON() in setup_bootmem_node()
Date: Thu, 04 Dec 2014 11:01:10 +0000 [thread overview]
Message-ID: <20141204110110.GD22643@mwanda> (raw)
In-Reply-To: <CAMuHMdVxCUYkaC5wzHi-o6knD6ugFudTdh3PJz5JCwv-std3GA@mail.gmail.com>
This off by one bug is harmless but it upsets the static checkers and
the code is obvious so it doesn't hurt to fix it. The Smatch warning
is:
arch/sh/mm/numa.c:47 setup_bootmem_node()
error: buffer overflow 'node_data' 1024 <= 1024
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 3d85225..bce52ba 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -31,7 +31,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
unsigned long bootmem_paddr;
/* Don't allow bogus node assignment */
- BUG_ON(nid > MAX_NUMNODES || nid <= 0);
+ BUG_ON(nid >= MAX_NUMNODES || nid <= 0);
start_pfn = start >> PAGE_SHIFT;
end_pfn = end >> PAGE_SHIFT;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-sh@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Mundt <lethal@linux-sh.org>
Subject: [patch] sh: off by one BUG_ON() in setup_bootmem_node()
Date: Thu, 4 Dec 2014 14:01:10 +0300 [thread overview]
Message-ID: <20141204110110.GD22643@mwanda> (raw)
In-Reply-To: <CAMuHMdVxCUYkaC5wzHi-o6knD6ugFudTdh3PJz5JCwv-std3GA@mail.gmail.com>
This off by one bug is harmless but it upsets the static checkers and
the code is obvious so it doesn't hurt to fix it. The Smatch warning
is:
arch/sh/mm/numa.c:47 setup_bootmem_node()
error: buffer overflow 'node_data' 1024 <= 1024
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 3d85225..bce52ba 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -31,7 +31,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
unsigned long bootmem_paddr;
/* Don't allow bogus node assignment */
- BUG_ON(nid > MAX_NUMNODES || nid <= 0);
+ BUG_ON(nid >= MAX_NUMNODES || nid <= 0);
start_pfn = start >> PAGE_SHIFT;
end_pfn = end >> PAGE_SHIFT;
next prev parent reply other threads:[~2014-12-04 11:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 12:39 sh: Support for multiple nodes Dan Carpenter
2014-12-03 13:05 ` Geert Uytterhoeven
2014-12-04 11:01 ` Dan Carpenter [this message]
2014-12-04 11:01 ` [patch] sh: off by one BUG_ON() in setup_bootmem_node() Dan Carpenter
2014-12-04 11:04 ` Geert Uytterhoeven
2014-12-04 11:04 ` Geert Uytterhoeven
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=20141204110110.GD22643@mwanda \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@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.