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

@ -228,7 +228,7 @@ void fsl_serdes_init(void)
break;
}
if (srds1_io_sel > ARRAY_SIZE(serdes1_cfg_tbl)) {
if (srds1_io_sel >= ARRAY_SIZE(serdes1_cfg_tbl)) {
printf("Invalid PORDEVSR[SRDS1_IO_SEL] = %d\n", srds1_io_sel);
return;
}
@ -237,7 +237,7 @@ void fsl_serdes_init(void)
serdes1_prtcl_map |= (1 << lane_prtcl);
}
if (srds2_io_sel > ARRAY_SIZE(serdes2_cfg_tbl)) {
if (srds2_io_sel >= ARRAY_SIZE(serdes2_cfg_tbl)) {
printf("Invalid PORDEVSR[SRDS2_IO_SEL] = %d\n", srds2_io_sel);
return;
}