* pata_platform: Fix NULL pointer dereference
@ 2007-07-20 3:50 ` Magnus Damm
2007-07-20 4:02 ` Paul Mundt
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Magnus Damm @ 2007-07-20 3:50 UTC (permalink / raw)
To: linux-kernel; +Cc: Paul Mundt, Magnus Damm, Jeff Garzik, Linus Torvalds
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.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
---
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(-)
--- 0001/drivers/ata/pata_platform.c
+++ work/drivers/ata/pata_platform.c 2007-07-20 12:09:04.000000000 +0900
@@ -213,8 +213,9 @@ static int __devinit pata_platform_probe
pata_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);
}
/**
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: pata_platform: Fix NULL pointer dereference
2007-07-20 3:50 ` pata_platform: Fix NULL pointer dereference Magnus Damm
@ 2007-07-20 4:02 ` Paul Mundt
2007-07-20 11:46 ` Jeff Garzik
2007-07-20 16:12 ` Linus Torvalds
2 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2007-07-20 4:02 UTC (permalink / raw)
To: Magnus Damm; +Cc: linux-kernel, Jeff Garzik, Linus Torvalds
On Fri, Jul 20, 2007 at 12:50:58PM +0900, Magnus Damm wrote:
> 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.
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
Without this, most of the sh and ppc pata_platform users won't boot.
Acked-by: Paul Mundt <lethal@linux-sh.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: pata_platform: Fix NULL pointer dereference
2007-07-20 3:50 ` pata_platform: Fix NULL pointer dereference Magnus Damm
2007-07-20 4:02 ` Paul Mundt
@ 2007-07-20 11:46 ` Jeff Garzik
2007-07-20 16:12 ` Linus Torvalds
2 siblings, 0 replies; 5+ messages in thread
From: Jeff Garzik @ 2007-07-20 11:46 UTC (permalink / raw)
To: Magnus Damm; +Cc: linux-kernel, Paul Mundt, Linus Torvalds
Magnus Damm wrote:
> 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.
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
>
> 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(-)
applied
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: pata_platform: Fix NULL pointer dereference
2007-07-20 3:50 ` pata_platform: Fix NULL pointer dereference Magnus Damm
2007-07-20 4:02 ` Paul Mundt
2007-07-20 11:46 ` Jeff Garzik
@ 2007-07-20 16:12 ` Linus Torvalds
2007-07-21 15:46 ` Jan Engelhardt
2 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2007-07-20 16:12 UTC (permalink / raw)
To: Magnus Damm; +Cc: linux-kernel, Paul Mundt, Jeff Garzik
On Fri, 20 Jul 2007, Magnus Damm wrote:
>
> 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.
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:
> + 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: pata_platform: Fix NULL pointer dereference
2007-07-20 16:12 ` Linus Torvalds
@ 2007-07-21 15:46 ` Jan Engelhardt
0 siblings, 0 replies; 5+ messages in thread
From: Jan Engelhardt @ 2007-07-21 15:46 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Magnus Damm, linux-kernel, Paul Mundt, Jeff Garzik
On Jul 20 2007 09:12, Linus Torvalds wrote:
>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:
>
>> + 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.
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
--
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-07-21 15:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20070720035058.25300.28389.sendpatchset@clockwork.opensource.s e>
2007-07-20 3:50 ` pata_platform: Fix NULL pointer dereference Magnus Damm
2007-07-20 4:02 ` Paul Mundt
2007-07-20 11:46 ` Jeff Garzik
2007-07-20 16:12 ` Linus Torvalds
2007-07-21 15:46 ` Jan Engelhardt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox