linux/arch/m68k
Geert Uytterhoeven f82a519f12 m68k: bitops - Never step beyond the end of the bitmap
find_next bitops on m68k (find_next_zero_bit, find_next_bit, and
find_next_bit_le) may cause out of bounds memory access
when the bitmap size in bits % 32 != 0 and offset (the bitnumber
to start searching at) is very close to the bitmap size.

For example,

       unsigned long bitmap[2] = { 0, 0 };
       find_next_bit(bitmap, 63, 62);

1. find_next_bit() tries to find any set bits in bitmap[1],
   but no bits set.

2. Then find_first_bit(bimap + 2, -1)

3. Unfortunately find_first_bit() takes unsigned int as the size argument.

4. find_first_bit will access bitmap[2~] until it find any set bits.

Add missing tests for stepping beyond the end of the bitmap to all
find_{first,next}_*() functions, and make sure they never return a value
larger than the bitmap size.

Reported-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
2011-05-19 18:19:09 +02:00
..
amiga m68k/amiga: Reclaim Chip RAM for PPC exception handlers 2011-03-16 19:10:40 +01:00
apollo m68k: apollo core - Kill warn_unused_result warnings 2009-01-12 20:56:35 +01:00
atari Fix common misspellings 2011-03-31 11:26:23 -03:00
bvme6000 m68k: Switch do_timer() to xtime_update() 2011-01-31 14:55:46 +01:00
configs m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
emu m68k/atari: ARAnyM - Add support for network access 2011-03-16 19:10:41 +01:00
fpsp040 Fix common misspellings 2011-03-31 11:26:23 -03:00
hp300 m68k: hp300 - Checkpatch cleanup 2010-05-17 21:15:40 +02:00
ifpsp060 Fix common misspellings 2011-03-31 11:26:23 -03:00
include/asm m68k: bitops - Never step beyond the end of the bitmap 2011-05-19 18:19:09 +02:00
kernel m68k,m68knommu: Wire up name_to_handle_at, open_by_handle_at, clock_adjtime, syncfs 2011-04-12 19:02:03 -07:00
lib m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
mac fix comment typos concerning "consistent" 2010-12-10 16:04:28 +01:00
math-emu m68k: Makefiles - Change to new flags variables 2011-03-16 19:10:41 +01:00
mm m68k/mm: Set all online nodes in N_NORMAL_MEMORY 2011-04-27 17:36:00 +02:00
mvme16x m68k: Switch do_timer() to xtime_update() 2011-01-31 14:55:46 +01:00
mvme147 m68k: Switch do_timer() to xtime_update() 2011-01-31 14:55:46 +01:00
platform Fix common misspellings 2011-03-31 11:26:23 -03:00
q40 Fix common misspellings 2011-03-31 11:26:23 -03:00
sun3 m68k: Switch do_timer() to xtime_update() 2011-01-31 14:55:46 +01:00
sun3x include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tools/amiga Convert files to UTF-8 and some cleanups 2007-10-19 23:21:04 +02:00
install.sh kbuild: use INSTALLKERNEL to select customized installkernel script 2009-09-20 12:18:14 +02:00
Kconfig genirq: Remove the now obsolete config options and select statements 2011-03-30 14:13:23 +02:00
Kconfig.debug m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
Kconfig.mmu m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
Kconfig.nommu m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
Makefile m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
Makefile_mm m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00
Makefile_no m68k: merge m68k and m68knommu arch directories 2011-03-25 14:05:13 +10:00