[libvirt] [PATCH] pci: Fix building of 32bit PCI command array

The pciWrite32 function assembled the array of data to be written to the fd with a bad offset on the last byte. This issue was probably caused by a typo (14, 24). --- src/util/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/pci.c b/src/util/pci.c index cf7722d..418c83d 100644 --- a/src/util/pci.c +++ b/src/util/pci.c @@ -268,7 +268,7 @@ pciWrite16(pciDevice *dev, int cfgfd, unsigned pos, uint16_t val) static void pciWrite32(pciDevice *dev, int cfgfd, unsigned pos, uint32_t val) { - uint8_t buf[4] = { (val >> 0), (val >> 8), (val >> 16), (val >> 14) }; + uint8_t buf[4] = { (val >> 0), (val >> 8), (val >> 16), (val >> 24) }; pciWrite(dev, cfgfd, pos, &buf[0], sizeof(buf)); } -- 1.8.0

On 05.12.2012 12:03, Peter Krempa wrote:
The pciWrite32 function assembled the array of data to be written to the fd with a bad offset on the last byte. This issue was probably caused by a typo (14, 24). --- src/util/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/util/pci.c b/src/util/pci.c index cf7722d..418c83d 100644 --- a/src/util/pci.c +++ b/src/util/pci.c @@ -268,7 +268,7 @@ pciWrite16(pciDevice *dev, int cfgfd, unsigned pos, uint16_t val) static void pciWrite32(pciDevice *dev, int cfgfd, unsigned pos, uint32_t val) { - uint8_t buf[4] = { (val >> 0), (val >> 8), (val >> 16), (val >> 14) }; + uint8_t buf[4] = { (val >> 0), (val >> 8), (val >> 16), (val >> 24) }; pciWrite(dev, cfgfd, pos, &buf[0], sizeof(buf)); }
ACK Michal

On 12/05/12 12:28, Michal Privoznik wrote:
On 05.12.2012 12:03, Peter Krempa wrote:
The pciWrite32 function assembled the array of data to be written to the fd with a bad offset on the last byte. This issue was probably caused by a typo (14, 24). --- src/util/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[...]
ACK
Michal
Pushed, thanks. Peter
participants (2)
-
Michal Privoznik
-
Peter Krempa