diff options
author | 2015-10-16 09:46:11 +0300 | |
---|---|---|
committer | 2015-10-16 09:46:11 +0300 | |
commit | 342fa5dfa053559f47caad657132522496dcf1b3 (patch) | |
tree | 0c5aec1a29aa36c0cb5272838435671af4279228 /qemu/hw/net/ne2000.c | |
parent | fdb8b20906f3546ba6c2f9f0686d8a5189516ba3 (diff) |
These changes comes from the qemu version 2.4.0.1 bugfix release,
taken from the official qemu wiki page. No further changes included.
Change-Id: I690a0aba6a986291252e766c60cf1fbea9a0cd46
Signed-off-by: José Pekkarinen <jose.pekkarinen@nokia.com>
Diffstat (limited to 'qemu/hw/net/ne2000.c')
-rw-r--r-- | qemu/hw/net/ne2000.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/qemu/hw/net/ne2000.c b/qemu/hw/net/ne2000.c index 3492db366..2bdb4c927 100644 --- a/qemu/hw/net/ne2000.c +++ b/qemu/hw/net/ne2000.c @@ -230,6 +230,9 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_) } index = s->curpag << 8; + if (index >= NE2000_PMEM_END) { + index = s->start; + } /* 4 bytes for header */ total_len = size + 4; /* address for next packet (4 bytes for CRC) */ @@ -253,7 +256,7 @@ ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_) if (index <= s->stop) avail = s->stop - index; else - avail = 0; + break; len = size; if (len > avail) len = avail; @@ -315,13 +318,19 @@ static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val) offset = addr | (page << 4); switch(offset) { case EN0_STARTPG: - s->start = val << 8; + if (val << 8 <= NE2000_PMEM_END) { + s->start = val << 8; + } break; case EN0_STOPPG: - s->stop = val << 8; + if (val << 8 <= NE2000_PMEM_END) { + s->stop = val << 8; + } break; case EN0_BOUNDARY: - s->boundary = val; + if (val << 8 < NE2000_PMEM_END) { + s->boundary = val; + } break; case EN0_IMR: s->imr = val; @@ -362,7 +371,9 @@ static void ne2000_ioport_write(void *opaque, uint32_t addr, uint32_t val) s->phys[offset - EN1_PHYS] = val; break; case EN1_CURPAG: - s->curpag = val; + if (val << 8 < NE2000_PMEM_END) { + s->curpag = val; + } break; case EN1_MULT ... EN1_MULT + 7: s->mult[offset - EN1_MULT] = val; |