aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci_endpoint
diff options
context:
space:
mode:
authorRamon Fried <rfried.dev@gmail.com>2019-07-15 23:04:41 +0300
committerTom Rini <trini@konsulko.com>2019-07-18 11:31:32 -0400
commiteb18742575158a680070002cf182b0c64311c1b2 (patch)
tree7e5a098053de83715338f69cda6473553f6d20d2 /drivers/pci_endpoint
parent80f485f6a4165d381ebeca9a10662b95b94151aa (diff)
downloadu-boot-eb18742575158a680070002cf182b0c64311c1b2.zip
u-boot-eb18742575158a680070002cf182b0c64311c1b2.tar.gz
u-boot-eb18742575158a680070002cf182b0c64311c1b2.tar.bz2
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") Signed-off-by: Ramon Fried <rfried.dev@gmail.com> [trini: Drop unused bar_idx] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/pci_endpoint')
-rw-r--r--drivers/pci_endpoint/sandbox-pci_ep.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/pci_endpoint/sandbox-pci_ep.c b/drivers/pci_endpoint/sandbox-pci_ep.c
index 0258433..8e05d5b 100644
--- a/drivers/pci_endpoint/sandbox-pci_ep.c
+++ b/drivers/pci_endpoint/sandbox-pci_ep.c
@@ -83,14 +83,11 @@ static int sandbox_read_bar(struct udevice *dev, uint fn,
struct pci_bar *ep_bar, enum pci_barno barno)
{
struct sandbox_pci_ep_priv *priv = dev_get_priv(dev);
- int bar_idx;
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;
}