powerpc: mpc85xx/mpc86xx: Fix off-by-one boundary checking with ARRAY_SIZE

If a variable is used as array subscript, it's valid value range is
0 ... ARRAY_SIZE -1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
This commit is contained in:
Axel Lin
2013-05-26 15:00:30 +08:00
committed by Andy Fleming
parent f90572d91b
commit e51e47d38e
19 changed files with 25 additions and 25 deletions

View File

@ -93,7 +93,7 @@ void fsl_serdes_init(void)
debug("PORDEVSR[IO_SEL_SRDS] = %x\n", srds_cfg);
if (srds_cfg > ARRAY_SIZE(serdes1_cfg_tbl)) {
if (srds_cfg >= ARRAY_SIZE(serdes1_cfg_tbl)) {
printf("Invalid PORDEVSR[IO_SEL_SRDS] = %d\n", srds_cfg);
return;
}
@ -102,7 +102,7 @@ void fsl_serdes_init(void)
serdes1_prtcl_map |= (1 << lane_prtcl);
}
if (srds_cfg > ARRAY_SIZE(serdes2_cfg_tbl)) {
if (srds_cfg >= ARRAY_SIZE(serdes2_cfg_tbl)) {
printf("Invalid PORDEVSR[IO_SEL_SRDS] = %d\n", srds_cfg);
return;
}