Skip to contentSkip to conversation

pci_ep: fix wrong addressing to barno

PATCH New Ramon Fried 2 participants 2 messages Jul 15, 2019 – Jul 19, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci_ep: fix wrong addressing to barno

barno was mistakely readed from the target structure, resulting in undefined behavious depending on the previous memory content. fix that.

Fixes bb413337826e ("pci_ep: add pci endpoint sandbox driver")
---
 drivers/pci_endpoint/sandbox-pci_ep.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pci_endpoint/sandbox-pci_ep.c +1 -3
index 0258433d8f..ca8871fc36 100644
@@ -88,9 +88,7 @@ static int sandbox_read_bar(struct udevice *dev, uint fn,
 	if (fn > 0)
 		return -ENODEV;
 
-	bar_idx = ep_bar->barno;
-
-	memcpy(ep_bar, &priv->bars[bar_idx], sizeof(*ep_bar));
+	memcpy(ep_bar, &priv->bars[barno], sizeof(*ep_bar));
 
 	return 0;
 }
Signature · 1 line
2.22.0
#1 lore raw

PATCH 1/1 pci_ep: fix wrong addressing to barno

Quoted 7 lines · Ramon Fried

barno was mistakely readed from the target structure, resulting in undefined behavious depending on the previous memory content. fix that.

Fixes bb413337826e ("pci_ep: add pci endpoint sandbox driver")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/7e8a52b3/attachment.sig>