lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240709133610.1089420-2-stewart.hildebrand@amd.com>
Date: Tue, 9 Jul 2024 09:35:58 -0400
From: Stewart Hildebrand <stewart.hildebrand@....com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
CC: Stewart Hildebrand <stewart.hildebrand@....com>,
	<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/6] PCI: don't clear already cleared bit

pci_reassigndev_resource_alignment() performs a PCI config read, then
then unconditionally clears a bit and issues a PCI config write.
However, the bit in question (PCI_COMMAND_MEMORY) is a RW bit, so it is
unnecessary to issue the PCI config write if the bit is already cleared.
Make the write conditional.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@....com>
---
Should this be folded into ("pci: restore memory decoding after
reallocation") in this series?
---
 drivers/pci/pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index df550953fa26..f017e7a8f028 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6632,8 +6632,10 @@ void pci_reassigndev_resource_alignment(struct pci_dev *dev)
 	}
 
 	pci_read_config_word(dev, PCI_COMMAND, &command);
-	command &= ~PCI_COMMAND_MEMORY;
-	pci_write_config_word(dev, PCI_COMMAND, command);
+	if (command & PCI_COMMAND_MEMORY) {
+		command &= ~PCI_COMMAND_MEMORY;
+		pci_write_config_word(dev, PCI_COMMAND, command);
+	}
 
 	for (i = 0; i <= PCI_ROM_RESOURCE; i++)
 		pci_request_resource_alignment(dev, i, align, resize);
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ