Skip to content

Commit

Permalink
sh: off by one BUG_ON() in setup_bootmem_node()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Paul Mundt <[email protected]>
Acked-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Dan Carpenter authored and torvalds committed Dec 11, 2014
1 parent 7b99078 commit ded0014
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/sh/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ded0014

Please sign in to comment.