All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuval Shaia <yuval.shaia.ml@gmail.com>
To: Chen Qun <kuhn.chenqun@huawei.com>
Cc: ganqixin@huawei.com, qemu-trivial@nongnu.org,
	QEMU Developers <qemu-devel@nongnu.org>,
	Euler Robot <euler.robot@huawei.com>,
	zhang.zhanghailiang@huawei.com
Subject: Re: [PATCH 2/6] hw/rdma/rdma_backend: fix uninitialized variable warning in rdma_poll_cq()
Date: Tue, 3 Nov 2020 21:49:59 +0200	[thread overview]
Message-ID: <CAMPkWoN1UA+jVBhhZCa3v0EiP+wBR_3gpBBwFWcFZQF0_3HgZQ@mail.gmail.com> (raw)
In-Reply-To: <20201103015228.2250547-3-kuhn.chenqun@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 1725 bytes --]

Thanks,

Reviewed-by:  Yuval Shaia <yuval.shaia.ml@gmail.com>

On Tue, 3 Nov 2020 at 03:53, Chen Qun <kuhn.chenqun@huawei.com> wrote:

> After the WITH_QEMU_LOCK_GUARD macro is added, the compiler cannot identify
>  that the statements in the macro must be executed. As a result, some
> variables
>  assignment statements in the macro may be considered as unexecuted by the
> compiler.
>
> The compiler showed warning:
> hw/rdma/rdma_backend.c: In function ‘rdma_poll_cq’:
> hw/rdma/rdma_utils.h:25:5: warning: ‘ne’ may be used uninitialized in this
> function [-Wmaybe-uninitialized]
>  25 |     error_report("%s: " fmt, "rdma", ## __VA_ARGS__)
>     |     ^~~~~~~~~~~~
> hw/rdma/rdma_backend.c:93:12: note: ‘ne’ was declared here
>  93 |     int i, ne, total_ne = 0;
>     |            ^~
>
> Add a default value for 'ne' to prevented the warning.
>
> Reported-by: Euler Robot <euler.robot@huawei.com>
> Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
> ---
> Cc: Yuval Shaia <yuval.shaia.ml@gmail.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> ---
>  hw/rdma/rdma_backend.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/rdma/rdma_backend.c b/hw/rdma/rdma_backend.c
> index 5de010b1fa..2fe4a3501c 100644
> --- a/hw/rdma/rdma_backend.c
> +++ b/hw/rdma/rdma_backend.c
> @@ -90,7 +90,7 @@ static void clean_recv_mads(RdmaBackendDev *backend_dev)
>
>  static int rdma_poll_cq(RdmaDeviceResources *rdma_dev_res, struct ibv_cq
> *ibcq)
>  {
> -    int i, ne, total_ne = 0;
> +    int i, ne = 0, total_ne = 0;
>      BackendCtx *bctx;
>      struct ibv_wc wc[2];
>      RdmaProtectedGSList *cqe_ctx_list;
> --
> 2.27.0
>
>

[-- Attachment #2: Type: text/html, Size: 2494 bytes --]

  parent reply	other threads:[~2020-11-03 19:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  1:52 [PATCH 0/6] fix uninitialized variable warning Chen Qun
2020-11-03  1:52 ` [PATCH 1/6] target/xtensa: " Chen Qun
2020-11-03  2:27   ` Philippe Mathieu-Daudé
2020-11-03  9:21   ` Max Filippov
2020-11-04  3:03     ` Chenqun (kuhn)
2020-11-03  1:52 ` [PATCH 2/6] hw/rdma/rdma_backend: fix uninitialized variable warning in rdma_poll_cq() Chen Qun
2020-11-03 16:41   ` Marcel Apfelbaum
2020-11-03 19:49   ` Yuval Shaia [this message]
2020-11-03  1:52 ` [PATCH 3/6] util/qemu-timer: fix uninitialized variable warning in timer_mod_anticipate_ns() Chen Qun
2020-11-03  2:13   ` Philippe Mathieu-Daudé
2020-11-03  1:52 ` [PATCH 4/6] util/qemu-timer: fix uninitialized variable warning for expire_time Chen Qun
2020-11-03  1:52 ` [PATCH 5/6] plugins/loader: fix uninitialized variable warning in plugin_reset_uninstall() Chen Qun
2020-11-03  2:18   ` Philippe Mathieu-Daudé
2020-11-03  2:34     ` Chenqun (kuhn)
2020-11-03  1:52 ` [PATCH 6/6] migration: fix uninitialized variable warning in migrate_send_rp_req_pages() Chen Qun
2020-11-03  2:22   ` Philippe Mathieu-Daudé
2020-11-03 10:15 ` [PATCH 0/6] fix uninitialized variable warning Peter Maydell
2020-11-03 10:44   ` Chenqun (kuhn)

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=CAMPkWoN1UA+jVBhhZCa3v0EiP+wBR_3gpBBwFWcFZQF0_3HgZQ@mail.gmail.com \
    --to=yuval.shaia.ml@gmail.com \
    --cc=euler.robot@huawei.com \
    --cc=ganqixin@huawei.com \
    --cc=kuhn.chenqun@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.