sata_sil: fix uninitialized variable use when sil_scr_read() fails
PATCH 1/1 sata_sil: fix uninitialized variable use when sil_scr_read() fails
--- drivers/ata/sata_sil.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/ata/sata_sil.c +1 -1
@@ -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
Signature · 1 line
1.6.5.1
Quoted 11 lines · Yoichi Yuasa
Signed-off-by Yoichi Yuasa <[email protected]>--- drivers/ata/sata_sil.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/ata/sata_sil.c +0
-0
drivers/ata/sata_sil.c static void sil_host_intr(struct ata_port *ap, u32 bmdma2) · line 442
Quoted 5 lines
drivers/ata/sata_sil.c +1
-1@@ -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.
Signature · 1 line
tejun
Hi Tejun,
2009/10/21 Tejun Heo <[email protected]>:
Quoted 20 lines
Quoted 11 lines · Yoichi Yuasa
Signed-off-by Yoichi Yuasa <[email protected]>---
drivers/ata/sata_sil.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/ata/sata_sil.c +0
-0drivers/ata/sata_sil.c static void sil_host_intr(struct ata_port *ap, u32 bmdma2) · line 442
Quoted 5 lines
drivers/ata/sata_sil.c +1
-1@@ -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
Quoted 5 lines
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
Quoted 11 lines · Yuasa Yoichi
Quoted 7 lines
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.
Signature · 1 line
tejun
Quoted 9 lines · On Mon, 26 Oct 2009 16:12:43 +0100 Tejun Heo <[email protected]> wrote:
Quoted 8 lines · Yuasa Yoichi
Quoted 7 lines
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.
Quoted 6 lines
Quoted 3 lines
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