From patchwork Mon Apr 19 16:44:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yizhuo Zhai X-Patchwork-Id: 1468012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ucr.edu header.i=@ucr.edu header.a=rsa-sha256 header.s=selector3 header.b=i1OE4GAe; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4FPCXT0Vywz9tlQ for ; Tue, 20 Apr 2021 02:52:09 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231891AbhDSQwh (ORCPT ); Mon, 19 Apr 2021 12:52:37 -0400 Received: from mx6.ucr.edu ([138.23.62.71]:51814 "EHLO mx6.ucr.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbhDSQwg (ORCPT ); Mon, 19 Apr 2021 12:52:36 -0400 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Mon, 19 Apr 2021 12:52:36 EDT DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ucr.edu; i=@ucr.edu; q=dns/txt; s=selector3; t=1618851127; x=1650387127; h=mime-version:from:date:message-id:subject:to; bh=duHvIeHjpjM4a9oNl5UBo/q1t227OzpBT0SpWquEusM=; b=i1OE4GAeLr3tJ/5AeVR8+2u8JC8Z6bIctkSM8clO2h0Di1w7ACHflKlA Ybg0Klb24/bRUmLjNjHZ0F162WubuMJG284c9zNbeDkzspO/jWu6ShbI2 /yXZvCGZsqbYkFTu/AZaPu0ePeDq+GUaxjb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BQXlEji2hD6mlwRA09T+Wzkc eykPMHkSLlkTp5YgBGpfmsMLSNKEmslqJdzpIWOd6ZPDXOnEuNAMVc4ZD5wzvmcheeysd42b 17e6ZzTP3cZGIK7/rS2wWzH9Y+zNTvysnB7tv29WtnTg1hdshbnmJEIzuce3cGIDVuNN4WEN 656tBcrzStPU4LZtm2b0NpY8Hz4/PMkpzibVoqJT4CrDOPgzSh9aLgH3GjtCs2Yndgx7Et9G SAqQjl/+GYte2hwBO07QDuxqUTo9fqxttdCMHksKR6FgnR X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="5.82,234,1613462400"; d="scan'208";a="208967637" Received: from mail-pl1-f200.google.com ([209.85.214.200]) by smtpmx6.ucr.edu with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 19 Apr 2021 09:45:00 -0700 Received: by mail-pl1-f200.google.com with SMTP id 59-20020a1709020241b02900e8de254a18so14265323plc.14 for ; Mon, 19 Apr 2021 09:45:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=606lIc0n/SwfFqg3bcljnuj3xNrVoZ0/M3CCbsQUgDM=; b=rR9nZS0Ir1lARG6D3lnv+1SqX1awAfoClEtB/SqkcBiMjG4Lj7ekg8YqzCcqYn9i0S EY+uhYMhUvS5sRnsJeMIHhD5oLEFSkSxWeiWk/L4ze0uDqX5+bxKmMzUfSOnmmVc3zy5 /mJhTG4SDgCUHXGUGbeU0xxJh57wBQQRv62tToLKACE2yhw/jVPBpQERefVBGnPOGYW8 6dhjOLjbgFoKAWcjplpW7gBbwXq3t+vV35Ds7+xRo5trr1P92jBMCTyQjkXt7FLvdEGS RuCGPSuykuGf6yjpPbp0dWZuBu2BRWBoXXwOSc1zlE7lELd7dUG0JQRjXoSB7Ab8kJZQ 2ong== X-Gm-Message-State: AOAM533IYyDqLrOWCRsXGXN3ffjrlxBV8Dv/CU0Hxd/gFAByV66A+pIi ZtzgBMehjHLe2bkOINvDZD/sb3qrlD4kVa1HPd3xW2eO1MlpKeOUmRvXcXhOjgHER179u5NsHjy RlqjaavdxM5gG4gXkN7cQyCaxSuU08qtVHX0QEw== X-Received: by 2002:a17:902:4c:b029:ec:a39a:41ad with SMTP id 70-20020a170902004cb02900eca39a41admr6722635pla.52.1618850699878; Mon, 19 Apr 2021 09:44:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoZtTgnMfhsKwkXBdsJ8fu5y1tpVSfP34IOTs31xByBl8rXi1GtJCyci+1KQloigDhhOUApH69W3a3EH+hrOI= X-Received: by 2002:a17:902:4c:b029:ec:a39a:41ad with SMTP id 70-20020a170902004cb02900eca39a41admr6722616pla.52.1618850699690; Mon, 19 Apr 2021 09:44:59 -0700 (PDT) MIME-Version: 1.0 From: Yizhuo Zhai Date: Mon, 19 Apr 2021 09:44:49 -0700 Message-ID: Subject: [PATCH] ata_piix: Fix uninitialized use in piix_check_450nx_errata() To: Jens Axboe , linux-ide@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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 --- drivers/ata/ata_piix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) PCI_DEVICE_ID_INTEL_82454NX, pdev)) != NULL) { 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,