linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sata_sil: fix uninitialized variable use when sil_scr_read() fails
@ 2009-10-20  6:34 Yoichi Yuasa
  2009-10-21  5:00 ` Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Yoichi Yuasa @ 2009-10-20  6:34 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: yuasa, linux-ide


Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>

---
 drivers/ata/sata_sil.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 3cb69d5..d7fff6b 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -439,7 +439,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
 	u8 status;
 
 	if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
-		u32 serror;
+		u32 serror = 0;
 
 		/* SIEN doesn't mask SATA IRQs on some 3112s.  Those
 		 * controllers continue to assert IRQ as long as
-- 
1.6.5.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] sata_sil: fix uninitialized variable use when sil_scr_read() fails
  2009-10-20  6:34 [PATCH] sata_sil: fix uninitialized variable use when sil_scr_read() fails Yoichi Yuasa
@ 2009-10-21  5:00 ` Tejun Heo
  2009-10-22  0:17   ` Yuasa Yoichi
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2009-10-21  5:00 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: Jeff Garzik, linux-ide

Yoichi Yuasa wrote:
> Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
> 
> ---
>  drivers/ata/sata_sil.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
> index 3cb69d5..d7fff6b 100644
> --- a/drivers/ata/sata_sil.c
> +++ b/drivers/ata/sata_sil.c
> @@ -439,7 +439,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
>  	u8 status;
>  
>  	if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
> -		u32 serror;
> +		u32 serror = 0;

The first usage of that is

  sil_scr_read(&ap->link, SCR_ERROR, &serror);

which sets the value.  So, I don't think the patch is necessary.  If
it triggers a compile warning, putting uninitialized_var() macro will
be more appropriate.

Thanks.

-- 
tejun


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sata_sil: fix uninitialized variable use when sil_scr_read() fails
  2009-10-21  5:00 ` Tejun Heo
@ 2009-10-22  0:17   ` Yuasa Yoichi
  2009-10-26 15:12     ` Tejun Heo
  0 siblings, 1 reply; 5+ messages in thread
From: Yuasa Yoichi @ 2009-10-22  0:17 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Jeff Garzik, linux-ide, yuasa

Hi Tejun,

2009/10/21 Tejun Heo <tj@kernel.org>:
> Yoichi Yuasa wrote:
>> Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
>>
>> ---
>>  drivers/ata/sata_sil.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
>> index 3cb69d5..d7fff6b 100644
>> --- a/drivers/ata/sata_sil.c
>> +++ b/drivers/ata/sata_sil.c
>> @@ -439,7 +439,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2)
>>       u8 status;
>>
>>       if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
>> -             u32 serror;
>> +             u32 serror = 0;
>
> The first usage of that is
>
>  sil_scr_read(&ap->link, SCR_ERROR, &serror);
>
> which sets the value.  So, I don't think the patch is necessary.  If
> it triggers a compile warning, putting uninitialized_var() macro will
> be more appropriate.

If sil_scr_read() is error, 'serror' is not initialized.
After that, the wrong bits add to 'ap->link.eh_info.serror' when
'serror & SERR_PHYRDT_CHG' is true.

Yoichi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sata_sil: fix uninitialized variable use when  sil_scr_read() fails
  2009-10-22  0:17   ` Yuasa Yoichi
@ 2009-10-26 15:12     ` Tejun Heo
  2009-10-27  1:37       ` Yoichi Yuasa
  0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2009-10-26 15:12 UTC (permalink / raw)
  To: Yuasa Yoichi; +Cc: Jeff Garzik, linux-ide

Yuasa Yoichi wrote:
>> The first usage of that is
>>
>>  sil_scr_read(&ap->link, SCR_ERROR, &serror);
>>
>> which sets the value.  So, I don't think the patch is necessary.  If
>> it triggers a compile warning, putting uninitialized_var() macro will
>> be more appropriate.
> 
> If sil_scr_read() is error, 'serror' is not initialized.
> After that, the wrong bits add to 'ap->link.eh_info.serror' when
> 'serror & SERR_PHYRDT_CHG' is true.

On the controller, sil_scr_read(SCR_ERROR) can never fail.  If it ever
fails, the whole thing will break anyway.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] sata_sil: fix uninitialized variable use when sil_scr_read() fails
  2009-10-26 15:12     ` Tejun Heo
@ 2009-10-27  1:37       ` Yoichi Yuasa
  0 siblings, 0 replies; 5+ messages in thread
From: Yoichi Yuasa @ 2009-10-27  1:37 UTC (permalink / raw)
  To: Tejun Heo; +Cc: yuasa, Jeff Garzik, linux-ide

On Mon, 26 Oct 2009 16:12:43 +0100
Tejun Heo <tj@kernel.org> wrote:

> Yuasa Yoichi wrote:
> >> The first usage of that is
> >>
> >>  sil_scr_read(&ap->link, SCR_ERROR, &serror);
> >>
> >> which sets the value.  So, I don't think the patch is necessary.  If
> >> it triggers a compile warning, putting uninitialized_var() macro will
> >> be more appropriate.
> > 
> > If sil_scr_read() is error, 'serror' is not initialized.
> > After that, the wrong bits add to 'ap->link.eh_info.serror' when
> > 'serror & SERR_PHYRDT_CHG' is true.
> 
> On the controller, sil_scr_read(SCR_ERROR) can never fail.  If it ever
> fails, the whole thing will break anyway.

OK, I got it.

Thanks,

Yoichi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-10-27  1:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-20  6:34 [PATCH] sata_sil: fix uninitialized variable use when sil_scr_read() fails Yoichi Yuasa
2009-10-21  5:00 ` Tejun Heo
2009-10-22  0:17   ` Yuasa Yoichi
2009-10-26 15:12     ` Tejun Heo
2009-10-27  1:37       ` Yoichi Yuasa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).