mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
hw/net/stellaris_enet: Avoid unintended sign extension
Add a cast to avoid an unintended sign extension that would mean we returned 0xffffffff in the high 32 bits for an IA0 read if bit 31 in the MAC address was 1. (This is harmless since we'll only be doing 4 byte reads, but it could be confusing, so best avoided.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Message-id: 1392647854-8067-3-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
ec1efab957
commit
106a73b6d2
1 changed files with 2 additions and 1 deletions
|
@ -176,7 +176,8 @@ static uint64_t stellaris_enet_read(void *opaque, hwaddr offset,
|
||||||
return val;
|
return val;
|
||||||
case 0x14: /* IA0 */
|
case 0x14: /* IA0 */
|
||||||
return s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8)
|
return s->conf.macaddr.a[0] | (s->conf.macaddr.a[1] << 8)
|
||||||
| (s->conf.macaddr.a[2] << 16) | (s->conf.macaddr.a[3] << 24);
|
| (s->conf.macaddr.a[2] << 16)
|
||||||
|
| ((uint32_t)s->conf.macaddr.a[3] << 24);
|
||||||
case 0x18: /* IA1 */
|
case 0x18: /* IA1 */
|
||||||
return s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8);
|
return s->conf.macaddr.a[4] | (s->conf.macaddr.a[5] << 8);
|
||||||
case 0x1c: /* THR */
|
case 0x1c: /* THR */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue