mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikita Kiryushin <kiryushin@ancud.ru>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Len Brown <lenb@kernel.org>, Lin Ming <ming.m.lin@intel.com>,
	Bob Moore <robert.moore@intel.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	lvc-project@linuxtesting.org
Subject: [PATCH] ACPI: OSL: Initialize output value
Date: Fri, 10 Nov 2023 22:45:19 +0300	[thread overview]
Message-ID: <ea6ef128-fa22-44b3-bd10-c136bc89c036@ancud.ru> (raw)

Buffer variable for result (value32) is not initialized.
This can lead to unexpected behavior, if underlying platform-specific
raw_pci_read fails to report error (uninitialized value will be treated
as valid pci-read result), or exposition of unexpected data to PCI 
config space reader.

Zeroing of buffer value addresses the later problem and makes the 
behavior in the former case somewhat more predictable.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: c5f0231ee6b0 ("ACPICA: Fix acpi_os_read_pci_configuration prototype")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
---
  drivers/acpi/osl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index c09cc3c68633..d3c0f7f01a29 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -788,7 +788,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id 
*pci_id, u32 reg,
  			       u64 *value, u32 width)
  {
  	int result, size;
-	u32 value32;
+	u32 value32 = 0U;
   	if (!value)
  		return AE_BAD_PARAMETER;
-- 
2.34.1


             reply	other threads:[~2023-11-10 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 19:45 Nikita Kiryushin [this message]
2023-11-21 20:05 ` Rafael J. Wysocki
2024-03-05 11:25   ` Nikita Kiryushin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea6ef128-fa22-44b3-bd10-c136bc89c036@ancud.ru \
    --to=kiryushin@ancud.ru \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=ming.m.lin@intel.com \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®