linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [BUG]memblock: fix overflow of array index
@ 2012-04-25  8:30 Peter Teoh
  2012-04-25 22:28 ` Tejun Heo
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Teoh @ 2012-04-25  8:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Tejun Heo, H. Peter Anvin, Andrew Morton, Ingo Molnar, linux-mm

Fixing the mismatch in signed and unsigned type assignment, which
potentially can lead to integer overflow bug.

Thanks.

Reviewed-by: Minchan Kim <minchan@kernel.org>
Signed-off-by: Peter Teoh <htmldeveloper@gmail.com>

diff --git a/mm/memblock.c b/mm/memblock.c
index a44eab3..2c621c5 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -553,8 +553,8 @@ void __init_memblock __next_free_mem_range(u64
*idx, int nid,
 {
      struct memblock_type *mem = &memblock.memory;
      struct memblock_type *rsv = &memblock.reserved;
-       int mi = *idx & 0xffffffff;
-       int ri = *idx >> 32;
+       unsigned int mi = *idx & 0xffffffff;
+       unsigned int ri = *idx >> 32;

      for ( ; mi < mem->cnt; mi++) {
              struct memblock_region *m = &mem->regions[mi];



--
Regards,
Peter Teoh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-04-26 15:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25  8:30 [BUG]memblock: fix overflow of array index Peter Teoh
2012-04-25 22:28 ` Tejun Heo
2012-04-25 22:29   ` H. Peter Anvin
2012-04-25 22:31     ` David Miller
2012-04-25 22:42       ` H. Peter Anvin
2012-04-26  0:50   ` Peter Teoh
2012-04-26  0:54     ` Yinghai Lu
2012-04-26 15:01     ` Tejun Heo

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).