Files
u-boot/board
Masahiro Yamada 61f06b143e m68k: fix an undefined behavior warning of M5253DEMO board
The latest GCC is so clever that it reports more warnings
than old ones did:

 ------------------------------>8------------------------------

  board/freescale/m5253demo/flash.c: In function 'flash_get_offsets':
  board/freescale/m5253demo/flash.c:65:23: warning: iteration 2047u
  invokes undefined behavior [-Waggressive-loop-optimizations]
      info->start[k + 1] = info->start[k] + CONFIG_SYS_SST_SECTSZ;
                         ^
  board/freescale/m5253demo/flash.c:64:3: note: containing loop
     for (k = 0, j = 0; j < CONFIG_SYS_SST_SECT; j++, k++) {
     ^

 ------------------------------8<------------------------------

The cause of the warning is like this:

The for statement iterates 2048 times in flash_get_offsets() func.
(Notice CONFIG_SYS_SST_SECT is defined as 2048)

The last iteration does
  info->start[2048] = info->start[2047] + CONFIG_SYS_SST_SECTSZ;
causing an undefined behavior.

(Please note the array size of info->start is 2048.
CONFIG_SYS_MAX_FLASH_SECT is defined as 2048 for this board.)

This commit fixes that so as not to overrun the info->start array.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Jason Jin <Jason.jin@freescale.com>
2014-07-22 09:46:48 -04:00
..
2014-03-12 17:04:57 -04:00
2014-06-06 17:46:16 -04:00
2014-02-19 11:07:50 -05:00
2014-03-10 13:50:31 -04:00
2014-02-21 13:55:41 -05:00
2014-04-23 19:07:54 -05:00
2013-11-26 21:49:34 +01:00
2014-01-24 16:59:07 -05:00
2014-03-12 17:04:55 -04:00
2014-06-11 16:27:05 -04:00
2014-06-19 11:19:06 -04:00
2014-01-24 16:59:07 -05:00
2014-05-25 16:26:43 +02:00
2014-02-26 21:18:09 +01:00
2014-01-24 16:59:07 -05:00