qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: andrew@daynix.com, dmitry.fleytman@gmail.com
Cc: jasowang@redhat.com, qemu-devel@nongnu.org
Subject: Re: [PATCH v2] Fixed integer overflow in e1000e
Date: Wed, 4 Mar 2020 16:41:49 +0100	[thread overview]
Message-ID: <badcfed3-94e4-b411-667d-616d790b28b3@redhat.com> (raw)
In-Reply-To: <20200304142058.52458-1-andrew@daynix.com>

On 3/4/20 3:20 PM, andrew@daynix.com wrote:
> From: Andrew Melnychenko <andrew@daynix.com>
> 
> Fixes: 6f3fbe4ed06
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1737400
> Fixed setting max_queue_num if there are no peers in NICConf. qemu_new_nic() creates NICState with 1 NetClientState(index 0) without peers, set max_queue_num to 0 - It prevents undefined behavior and possible crashes, especially during pcie hotplug.

Hoping the maintainer taking this can reformat the commit description a 
bit nicer... (moving the tags down), then for the code part:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> 
> Signed-off-by: Andrew Melnychenko <andrew@daynix.com>
> ---
>   hw/net/e1000e.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c
> index a91dbdca3c..f2cc1552c5 100644
> --- a/hw/net/e1000e.c
> +++ b/hw/net/e1000e.c
> @@ -328,7 +328,7 @@ e1000e_init_net_peer(E1000EState *s, PCIDevice *pci_dev, uint8_t *macaddr)
>       s->nic = qemu_new_nic(&net_e1000e_info, &s->conf,
>           object_get_typename(OBJECT(s)), dev->id, s);
>   
> -    s->core.max_queue_num = s->conf.peers.queues - 1;
> +    s->core.max_queue_num = s->conf.peers.queues ? s->conf.peers.queues - 1 : 0;
>   
>       trace_e1000e_mac_set_permanent(MAC_ARG(macaddr));
>       memcpy(s->core.permanent_mac, macaddr, sizeof(s->core.permanent_mac));
> 



  reply	other threads:[~2020-03-04 15:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04 14:20 [PATCH v2] Fixed integer overflow in e1000e andrew
2020-03-04 15:41 ` Philippe Mathieu-Daudé [this message]
2020-03-17  6:20   ` Jason Wang
2020-03-05  9:14 ` Dmitry Fleytman
2020-03-05  9:17 ` Dmitry Fleytman
2020-03-17  6:18   ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=badcfed3-94e4-b411-667d-616d790b28b3@redhat.com \
    --to=philmd@redhat.com \
    --cc=andrew@daynix.com \
    --cc=dmitry.fleytman@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).