pata_platform: Fix NULL pointer dereference
pata_platform: Fix NULL pointer dereference
pata_platform currently dereferences a NULL pointer in pata_platform_probe() if pdev->dev.platform_data is set to NULL. This breakage was most likely introduced by commit 5f45bc50976ee1f408f7171af155aec646655a37.
---
Tested on a Solution Engline 7722 board, fixes NULL dereference problem. Applies to linux-2.6 git 9a79b2274186fade17134929d4f85b70d59a3840 Could someone please make sure this gets included in rc1?
drivers/ata/pata_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/pata_platform.c +3 -2
@@ -213,8 +213,9 @@ static int __devinit pata_platform_probepata_platform_setup_port (&ap->ioaddr, pp_info);/* activate */ -return ata_host_activate (host,platform_get_irq (pdev,0 ), ata_interrupt, - pp_info->irq_flags, &pata_platform_sht); +return ata_host_activate (host,platform_get_irq (pdev,0 ), + ata_interrupt, pp_info ? pp_info->irq_flags + :0 , &pata_platform_sht); }/**
Paul Mundt
Acked-byQuoted 7 lines · Magnus Damm
pata_platform: Fix NULL pointer dereference
pata_platformcurrently dereferences a NULL pointer inpata_platform_probe()ifpdev->dev.platform_datais set to NULL. This breakage was most likely introduced by commit5f45bc50976ee1f408f7171af155aec646655a37.Signed-off-by Magnus Damm <[email protected]>
Without this, most of the sh and ppc pata_platform users won't boot.
Jeff Garzik
AppliedQuoted 7 lines · Magnus Damm
pata_platform: Fix NULL pointer dereference
pata_platformcurrently dereferences a NULL pointer inpata_platform_probe()ifpdev->dev.platform_datais set to NULL. This breakage was most likely introduced by commit5f45bc50976ee1f408f7171af155aec646655a37.Signed-off-by Magnus Damm <[email protected]>
Quoted 8 lines
---
Tested on a Solution Engline 7722 board, fixes NULL dereference problem. Applies to linux-2.6 git
9a79b2274186fade17134929d4f85b70d59a3840Could someone please make sure this gets included in rc1?drivers/ata/pata_platform.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
applied
Quoted 4 lines · Magnus Damm
pata_platformcurrently dereferences a NULL pointer inpata_platform_probe()ifpdev->dev.platform_datais set to NULL. This breakage was most likely introduced by commit5f45bc50976ee1f408f7171af155aec646655a37.
Ok, the *fix* looks real enough, but it seems that you have done your line splitting with a word processor rather than with a source code editor:
drivers/ata/pata_platform.c static int __devinit pata_platform_probe · line 218
Quoted 3 lines
drivers/ata/pata_platform.c +3
-0+return ata_host_activate (host,platform_get_irq (pdev,0 ), + ata_interrupt, pp_info ? pp_info->irq_flags + :0 , &pata_platform_sht);
Please don't do things like this. Splitting up expressions across two lines just to make the line length come out "right" is silly.
So do the
"pp_info ? pp_info->irq_flags : 0"
expression on one line.
And if it means that the line is longe rthan 80 characters, then so be it. It's ok. It's still more readable than the alternative.
Linus "nit-picking bastard" Torvalds
Quoted 10 lines · Linus Torvalds
Ok, the *fix* looks real enough, but it seems that you have done your line splitting with a word processor rather than with a source code editor:
drivers/ata/pata_platform.c static int __devinit pata_platform_probe · line 218
Quoted 3 lines
drivers/ata/pata_platform.c +3
-0+return ata_host_activate (host,platform_get_irq (pdev,0 ), + ata_interrupt, pp_info ? pp_info->irq_flags + :0 , &pata_platform_sht);Please don't do things like this. Splitting up expressions across two lines just to make the line length come out "right" is silly.
Quoted 5 lines
So do the
"pp_info ? pp_info->irq_flags : 0"expression on one line.
Or just do
return ata_host_activate(host, platform_get_irq(pdev, 0), ata_interrupt, pp_info ? pp_info->irq_flags : 0, &pata_platform_sht);
for returns, it's ok.
Jan