[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/4] pcnet: fix Negative array index read
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 3/4] pcnet: fix Negative array index read |
Date: |
Thu, 20 Nov 2014 08:08:48 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
On 20/11/2014 07:44, Gonglei wrote:
> Maybe not, since two branch are "if and else if" not "if and else",
> so this change make the below code segment's wide ...
>> > bcnt = 4096 - GET_FIELD(tmd.length, TMDL, BCNT);
>> > s->phys_mem_read(s->dma_opaque, PHYSADDR(s, tmd.tbadr),
>> > s->buffer + s->xmit_pos, bcnt, CSR_BSWP(s));
>> > s->xmit_pos += bcnt;
> ... more extensive.
After your patch that fixes the coverity report, they are
if (a && b)
else if (b)
so you can change it to
if (!b) goto txdone;
if (a) ...
else ...
and then
if (!b) goto txdone;
<common part>
if (!a) {
<extra part from else>
}
Paolo
[Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, arei.gonglei, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Paolo Bonzini, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Jason Wang, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Gonglei, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Jason Wang, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Gonglei, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Jason Wang, 2014/11/20
- Re: [Qemu-devel] [PATCH 4/4] rtl8139: fix Pointer to local outside scope, Gonglei, 2014/11/20