diff options
author | Eric Sesterhenn <snakebyte@gmx.de> | 2006-10-10 17:37:29 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-10-16 01:52:14 -0400 |
commit | bb579cf1d413b930be0241987b848e0f0c1b292f (patch) | |
tree | 2a57ee873749bbb12eca3b1f5cff01fa22ddf760 /arch | |
parent | ee4ea82c07fa8aa46037962ec3e8b40c5144b5eb (diff) |
[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')
-rw-r--r-- | arch/ppc/platforms/mpc8272ads_setup.c | 4 | ||||
-rw-r--r-- | arch/ppc/platforms/mpc866ads_setup.c | 4 | ||||
-rw-r--r-- | arch/ppc/platforms/mpc885ads_setup.c | 4 |
3 files changed, 6 insertions, 6 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, | |||
196 | bd_t* bi = (void*)__res; | 196 | bd_t* bi = (void*)__res; |
197 | int fs_no = fsid_fcc1+pdev->id-1; | 197 | int fs_no = fsid_fcc1+pdev->id-1; |
198 | 198 | ||
199 | if(fs_no > ARRAY_SIZE(mpc82xx_enet_pdata)) { | 199 | if(fs_no >= ARRAY_SIZE(mpc82xx_enet_pdata)) { |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | 202 | ||
@@ -222,7 +222,7 @@ static void mpc8272ads_fixup_uart_pdata(struct platform_device *pdev, | |||
222 | int id = fs_uart_id_scc2fsid(idx); | 222 | int id = fs_uart_id_scc2fsid(idx); |
223 | 223 | ||
224 | /* no need to alter anything if console */ | 224 | /* no need to alter anything if console */ |
225 | if ((id <= num) && (!pdev->dev.platform_data)) { | 225 | if ((id < num) && (!pdev->dev.platform_data)) { |
226 | pinfo = &mpc8272_uart_pdata[id]; | 226 | pinfo = &mpc8272_uart_pdata[id]; |
227 | pinfo->uart_clk = bd->bi_intfreq; | 227 | pinfo->uart_clk = bd->bi_intfreq; |
228 | pdev->dev.platform_data = pinfo; | 228 | pdev->dev.platform_data = pinfo; |
diff --git a/arch/ppc/platforms/mpc866ads_setup.c b/arch/ppc/platforms/mpc866ads_setup.c index 5f130dca3770..e95d2c111747 100644 --- a/arch/ppc/platforms/mpc866ads_setup.c +++ b/arch/ppc/platforms/mpc866ads_setup.c | |||
@@ -259,7 +259,7 @@ static void mpc866ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) | |||
259 | /* Get pointer to Communication Processor */ | 259 | /* Get pointer to Communication Processor */ |
260 | cp = cpmp; | 260 | cp = cpmp; |
261 | 261 | ||
262 | if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { | 262 | if(fs_no >= ARRAY_SIZE(mpc8xx_enet_pdata)) { |
263 | printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); | 263 | printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); |
264 | return; | 264 | return; |
265 | } | 265 | } |
@@ -305,7 +305,7 @@ static void __init mpc866ads_fixup_uart_pdata(struct platform_device *pdev, | |||
305 | int id = fs_uart_id_smc2fsid(idx); | 305 | int id = fs_uart_id_smc2fsid(idx); |
306 | 306 | ||
307 | /* no need to alter anything if console */ | 307 | /* no need to alter anything if console */ |
308 | if ((id <= num) && (!pdev->dev.platform_data)) { | 308 | if ((id < num) && (!pdev->dev.platform_data)) { |
309 | pinfo = &mpc866_uart_pdata[id]; | 309 | pinfo = &mpc866_uart_pdata[id]; |
310 | pinfo->uart_clk = bd->bi_intfreq; | 310 | pinfo->uart_clk = bd->bi_intfreq; |
311 | pdev->dev.platform_data = pinfo; | 311 | pdev->dev.platform_data = pinfo; |
diff --git a/arch/ppc/platforms/mpc885ads_setup.c b/arch/ppc/platforms/mpc885ads_setup.c index 02293141efb5..f8161f3557f5 100644 --- a/arch/ppc/platforms/mpc885ads_setup.c +++ b/arch/ppc/platforms/mpc885ads_setup.c | |||
@@ -263,7 +263,7 @@ static void mpc885ads_fixup_enet_pdata(struct platform_device *pdev, int fs_no) | |||
263 | char *e; | 263 | char *e; |
264 | int i; | 264 | int i; |
265 | 265 | ||
266 | if(fs_no > ARRAY_SIZE(mpc8xx_enet_pdata)) { | 266 | if(fs_no >= ARRAY_SIZE(mpc8xx_enet_pdata)) { |
267 | printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); | 267 | printk(KERN_ERR"No network-suitable #%d device on bus", fs_no); |
268 | return; | 268 | return; |
269 | } | 269 | } |
@@ -371,7 +371,7 @@ static void __init mpc885ads_fixup_uart_pdata(struct platform_device *pdev, | |||
371 | int id = fs_uart_id_smc2fsid(idx); | 371 | int id = fs_uart_id_smc2fsid(idx); |
372 | 372 | ||
373 | /* no need to alter anything if console */ | 373 | /* no need to alter anything if console */ |
374 | if ((id <= num) && (!pdev->dev.platform_data)) { | 374 | if ((id < num) && (!pdev->dev.platform_data)) { |
375 | pinfo = &mpc885_uart_pdata[id]; | 375 | pinfo = &mpc885_uart_pdata[id]; |
376 | pinfo->uart_clk = bd->bi_intfreq; | 376 | pinfo->uart_clk = bd->bi_intfreq; |
377 | pdev->dev.platform_data = pinfo; | 377 | pdev->dev.platform_data = pinfo; |