[PATCH] ata_piix: Fix uninitialized use in piix_check_450nx_errata()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inside function piix_check_450nx_errata(), variable "cfg" could be
uninitialized if pci_bus_read_config_word() returns
PCIBIOS_BAD_REGISTER_NUMBER. However, it is directly used in if
statement, which is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@xxxxxxx>
---
 drivers/ata/ata_piix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index 3ca7720e7d8f..0acc1ba9eae2 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -1309,7 +1309,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
 static int piix_check_450nx_errata(struct pci_dev *ata_dev)
 {
        struct pci_dev *pdev = NULL;
-       u16 cfg;
+       u16 cfg = ~0;
        int no_piix_dma = 0;

        while ((pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL) {
-- 
2.31.1



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux