summaryrefslogtreecommitdiffstats
path: root/arch/ppc/platforms/mpc8272ads_setup.c
diff options
context:
space:
mode:
authorEric Sesterhenn <snakebyte@gmx.de>2006-10-10 14:37:29 -0700
committerPaul Mackerras <paulus@samba.org>2006-10-16 15:52:14 +1000
commitbb579cf1d413b930be0241987b848e0f0c1b292f (patch)
tree2a57ee873749bbb12eca3b1f5cff01fa22ddf760 /arch/ppc/platforms/mpc8272ads_setup.c
parentee4ea82c07fa8aa46037962ec3e8b40c5144b5eb (diff)
downloadblackbird-obmc-linux-bb579cf1d413b930be0241987b848e0f0c1b292f.tar.gz
blackbird-obmc-linux-bb579cf1d413b930be0241987b848e0f0c1b292f.zip
[POWERPC] Off-by-one in /arch/ppc/platforms/mpc8*
A find -iname \*.[ch] | xargs grep "> ARRAY_SIZE(" revealed several incorrect usages of ARRAY_SIZE in the mpc drivers. The last element in the array is always ARRAY_SIZE()-1, this patch modifies the bounds checks accordingly. Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de> Cc: Vitaly Bordug <vbordug@ru.mvista.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc/platforms/mpc8272ads_setup.c')
-rw-r--r--arch/ppc/platforms/mpc8272ads_setup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/ppc/platforms/mpc8272ads_setup.c b/arch/ppc/platforms/mpc8272ads_setup.c
index d7b3a6afa78f..1f9ea36837b1 100644
--- a/arch/ppc/platforms/mpc8272ads_setup.c
+++ b/arch/ppc/platforms/mpc8272ads_setup.c
@@ -196,7 +196,7 @@ static void __init mpc8272ads_fixup_enet_pdata(struct platform_device *pdev,
bd_t* bi = (void*)__res;
int fs_no = fsid_fcc1+pdev->id-1;
- if(fs_no > ARRAY_SIZE(mpc82xx_enet_pdata)) {
+ if(fs_no >= ARRAY_SIZE(mpc82xx_enet_pdata)) {
return;
}
@@ -222,7 +222,7 @@ static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev,
int id = fs_uart_id_scc2fsid(idx);
/* no need to alter anything if console */
- if ((id <= num) && (!pdev->dev.platform_data)) {
+ if ((id < num) && (!pdev->dev.platform_data)) {
pinfo = &mpc8272_uart_pdata[id];
pinfo->uart_clk = bd->bi_intfreq;
pdev->dev.platform_data = pinfo;
OpenPOWER on IntegriCloud