qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] softmmu/device_tree: Fixup local variables shadowing


From: Daniel Henrique Barboza
Subject: Re: [PATCH 4/4] softmmu/device_tree: Fixup local variables shadowing
Date: Mon, 25 Sep 2023 06:10:07 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1



On 9/25/23 01:30, Alistair Francis wrote:
Local variables shadowing other local variables or parameters make the
code needlessly hard to understand.  Bugs love to hide in such code.
Evidence: "[PATCH v3 1/7] migration/rdma: Fix save_page method to fail
on polling error".

This patch removes the local variable shadowing. Tested by adding:

     --extra-cflags='-Wshadow=local -Wno-error=shadow=local 
-Wno-error=shadow=compatible-local'

To configure

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

  softmmu/device_tree.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c
index 30aa3aea9f..eb5166ca36 100644
--- a/softmmu/device_tree.c
+++ b/softmmu/device_tree.c
@@ -418,9 +418,9 @@ int qemu_fdt_setprop_string_array(void *fdt, const char 
*node_path,
      }
      p = str = g_malloc0(total_len);
      for (i = 0; i < len; i++) {
-        int len = strlen(array[i]) + 1;
-        pstrcpy(p, len, array[i]);
-        p += len;
+        int offset = strlen(array[i]) + 1;
+        pstrcpy(p, offset, array[i]);
+        p += offset;
      }
ret = qemu_fdt_setprop(fdt, node_path, prop, str, total_len);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]