qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Li Qiang <liq3ea@163.com>,
	stefanha@redhat.com, marcandre.lureau@redhat.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw: set_netdev: make peers an empty
Date: Thu, 8 Nov 2018 15:43:06 +0100	[thread overview]
Message-ID: <39d3e8a4-4166-996a-8f62-89dc0dcebe6c@redhat.com> (raw)
In-Reply-To: <20181108143306.20187-1-liq3ea@163.com>

On 08/11/2018 15:33, Li Qiang wrote:
> Though there is no inconsistency between 'queues'
> and 'peers[i]' currently, this makes the 'peers[i] == NULL'
> meaningful.
> 
> Signed-off-by: Li Qiang <liq3ea@163.com>
> ---
>  hw/core/qdev-properties-system.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
> index 8b22fb51c9..74004a2f33 100644
> --- a/hw/core/qdev-properties-system.c
> +++ b/hw/core/qdev-properties-system.c
> @@ -257,7 +257,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
>      Property *prop = opaque;
>      NICPeers *peers_ptr = qdev_get_prop_ptr(dev, prop);
>      NetClientState **ncs = peers_ptr->ncs;
> -    NetClientState *peers[MAX_QUEUE_NUM];
> +    NetClientState *peers[MAX_QUEUE_NUM] = {NULL};
>      Error *local_err = NULL;
>      int queues, err = 0, i = 0;
>      char *str;
> 

peers[] is initialized by qemu_find_net_clients_excep() until "queues"
entries. So between 0 and "queues" peers[] cannot be NULL.

IMHO, you should remove the "if (peers[i] == NULL)" block instead.

Thanks,
Laurent

      reply	other threads:[~2018-11-08 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08 14:33 [Qemu-devel] [PATCH] hw: set_netdev: make peers an empty Li Qiang
2018-11-08 14:43 ` Laurent Vivier [this message]

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=39d3e8a4-4166-996a-8f62-89dc0dcebe6c@redhat.com \
    --to=lvivier@redhat.com \
    --cc=liq3ea@163.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).