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
..
2010-10-22 09:43:22 +02:00
2010-05-26 19:51:09 +02:00
2009-12-12 13:08:14 +01:00
2011-01-23 11:24:35 +01:00
2011-03-31 11:26:23 -03:00
2010-10-22 09:43:24 +02:00
2011-05-19 18:19:09 +02:00
2011-03-23 19:46:22 -07:00
2009-06-11 21:02:14 +02:00
2009-12-04 15:39:55 +01:00
2011-03-31 11:26:23 -03:00
2009-03-24 15:17:44 +10:00
2009-03-24 15:17:45 +10:00
2010-08-11 08:59:21 -07:00
2009-11-26 09:16:19 +01:00
2011-01-05 15:19:20 +10:00
2009-09-16 09:43:37 +10:00
2011-03-15 21:01:57 +10:00
2011-03-31 11:26:23 -03:00
2009-03-24 15:17:45 +10:00
2011-03-31 11:26:23 -03:00
2009-03-24 15:17:45 +10:00
2010-08-11 08:59:21 -07:00
2009-09-16 09:43:38 +10:00
2009-12-16 07:20:12 -08:00
2010-10-26 16:52:12 -07:00
2011-01-05 15:19:18 +10:00
2009-03-24 15:17:44 +10:00
2010-02-05 12:22:42 +01:00
2009-05-29 08:40:02 -07:00
2009-03-24 15:17:42 +10:00
2009-03-02 16:49:37 -05:00
2011-03-31 11:26:23 -03:00
2009-10-01 16:11:11 -07:00
2009-09-16 09:43:36 +10:00
2009-03-24 15:17:42 +10:00
2010-08-18 12:44:31 +10:00
2010-10-22 09:43:25 +02:00
2011-01-05 15:19:18 +10:00
2010-10-22 09:43:23 +02:00
2009-09-16 09:43:37 +10:00
2010-11-03 11:30:07 +10:00
2009-06-16 19:47:51 -07:00
2010-06-09 11:12:36 +02:00
2011-01-05 15:19:20 +10:00
2011-01-05 15:19:20 +10:00
2011-01-05 15:19:20 +10:00
2011-01-18 08:05:20 -08:00
2011-03-15 21:01:57 +10:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-15 21:01:57 +10:00
2011-03-15 21:01:57 +10:00
2011-03-15 21:01:57 +10:00
2011-03-15 21:01:57 +10:00
2011-03-15 21:01:57 +10:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2011-03-31 11:26:23 -03:00
2010-11-03 11:29:58 +10:00
2010-02-27 18:31:09 +01:00
2011-03-31 11:26:23 -03:00
2010-02-27 18:31:09 +01:00
2009-08-31 18:08:49 +02:00
2009-03-24 15:17:41 +10:00
2011-03-15 21:01:54 +10:00
2009-09-10 12:01:22 +10:00
2009-09-16 09:43:52 +10:00
2009-09-16 09:43:55 +10:00
2011-03-15 21:01:54 +10:00
2010-05-17 11:04:19 +10:00
2011-01-05 15:19:17 +10:00
2010-10-21 10:17:30 +10:00
2011-03-31 11:26:23 -03:00
2011-01-05 15:19:17 +10:00
2009-09-22 07:17:42 -07:00
2009-03-24 15:17:45 +10:00
2009-03-24 15:17:42 +10:00
2009-03-24 15:17:45 +10:00
2009-08-26 23:14:49 +02:00
2010-10-26 16:52:08 -07:00
2011-03-16 19:10:41 +01:00
2009-09-10 12:01:24 +10:00
2010-10-22 09:43:25 +02:00
2010-10-22 09:43:24 +02:00
2009-03-24 15:17:43 +10:00
2010-10-22 09:43:24 +02:00
2010-05-17 21:15:39 +02:00
2009-03-24 15:17:41 +10:00
2009-03-24 15:17:43 +10:00
2010-02-20 16:41:46 +00:00
2009-03-24 15:17:43 +10:00
2009-09-10 12:01:22 +10:00
2011-03-16 19:10:40 +01:00
2010-03-12 15:52:38 -08:00
2009-04-02 01:05:31 +00:00
2010-08-07 18:15:50 +02:00
2009-03-24 15:17:44 +10:00
2009-03-17 08:44:41 +10:00
2010-04-14 19:45:37 +02:00
2010-02-27 18:31:17 +01:00
2009-06-11 21:01:52 +02:00
2009-10-12 13:26:31 -07:00
2011-02-16 09:43:16 +10:00
2009-07-27 12:10:38 -07:00
2011-01-05 21:17:19 +01:00
2010-02-27 18:27:13 +01:00
2010-10-22 17:33:35 -07:00
2010-10-22 17:33:35 -07:00
2010-08-10 13:47:39 -07:00
2011-01-07 14:01:33 +01:00
2009-09-16 09:43:56 +10:00
2009-03-24 15:17:45 +10:00
2010-10-22 09:43:24 +02:00
2011-03-23 19:47:18 -07:00
2010-02-27 18:44:10 +01:00
2009-03-24 15:17:43 +10:00
2011-04-12 19:02:03 -07:00
2010-02-27 18:31:18 +01:00