]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
softmmu/device_tree: Fixup local variables shadowing
authorAlistair Francis <alistair23@gmail.com>
Mon, 25 Sep 2023 04:30:23 +0000 (14:30 +1000)
committerMarkus Armbruster <armbru@redhat.com>
Fri, 29 Sep 2023 08:07:20 +0000 (10:07 +0200)
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>
Message-ID: <20230925043023.71448-5-alistair.francis@wdc.com>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
softmmu/device_tree.c

index 30aa3aea9fad1e7abe1d06e581500b90b8fdd099..eb5166ca36080914bbe10c82ed6e8d8f097bb2cc 100644 (file)
@@ -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);