diff mbox series

[2/2] hw/net/opencores_eth: Remove unnecessary address masking

Message ID 20200608091508.19838-3-f4bug@amsat.org
State New
Headers show
Series hw/net/opencores_eth: Trivial patches | expand

Commit Message

Philippe Mathieu-Daudé June 8, 2020, 9:15 a.m. UTC
The memory region is limited to 1 KiB, so the address is
garantied to be in that range. No need to mask.

  711 static const MemoryRegionOps open_eth_desc_ops = {
  712     .read = open_eth_desc_read,
  713     .write = open_eth_desc_write,
  714 };
  ...
  725     memory_region_init_io(&s->desc_io, OBJECT(dev),
  725                           &open_eth_desc_ops, s,
  726                           "open_eth.desc", 0x400);

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/net/opencores_eth.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Max Filippov June 8, 2020, 9:27 a.m. UTC | #1
On Mon, Jun 8, 2020 at 2:15 AM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> The memory region is limited to 1 KiB, so the address is
> garantied to be in that range. No need to mask.
>
>   711 static const MemoryRegionOps open_eth_desc_ops = {
>   712     .read = open_eth_desc_read,
>   713     .write = open_eth_desc_write,
>   714 };
>   ...
>   725     memory_region_init_io(&s->desc_io, OBJECT(dev),
>   725                           &open_eth_desc_ops, s,
>   726                           "open_eth.desc", 0x400);
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/net/opencores_eth.c | 2 --
>  1 file changed, 2 deletions(-)

Acked-by: Max Filippov <jcmvbkbc@gmail.com>
diff mbox series

Patch

diff --git a/hw/net/opencores_eth.c b/hw/net/opencores_eth.c
index 90d3846bb7..0c9879e8a7 100644
--- a/hw/net/opencores_eth.c
+++ b/hw/net/opencores_eth.c
@@ -687,7 +687,6 @@  static uint64_t open_eth_desc_read(void *opaque,
     OpenEthState *s = opaque;
     uint64_t v = 0;
 
-    addr &= 0x3ff;
     memcpy(&v, (uint8_t *)s->desc + addr, size);
     trace_open_eth_desc_read((uint32_t)addr, (uint32_t)v);
     return v;
@@ -698,7 +697,6 @@  static void open_eth_desc_write(void *opaque,
 {
     OpenEthState *s = opaque;
 
-    addr &= 0x3ff;
     trace_open_eth_desc_write((uint32_t)addr, (uint32_t)val);
     memcpy((uint8_t *)s->desc + addr, &val, size);
     open_eth_check_start_xmit(s);