|
From: | wangyanan (Y) |
Subject: | Re: [PATCH] softmmu/device_tree: Silence compiler warning with --enable-sanitizers |
Date: | Mon, 10 Jan 2022 10:10:57 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
On 2022/1/8 4:18, Richard Henderson wrote:
On 1/7/22 5:38 AM, Thomas Huth wrote:diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c index 3965c834ca..9e96f5ecd5 100644 --- a/softmmu/device_tree.c +++ b/softmmu/device_tree.c @@ -564,7 +564,7 @@ int qemu_fdt_add_path(void *fdt, const char *path) return -1; } - while (p) { + do { name = p + 1; p = strchr(name, '/'); namelen = p != NULL ? p - name : strlen(name); @@ -584,7 +584,7 @@ int qemu_fdt_add_path(void *fdt, const char *path) } parent = retval; - } + } while (p);Reviewed-by: Richard Henderson <richard.henderson@linaro.org>In addition, the copy between 'path' and 'p' is unnecessary -- one of the variables should be removed. Either rename the parameter to 'p', or rename all uses to 'path'.
Yes. We can simply remove "const char *p = path;" and directly using the parameter "path" passed in would be fine enough. Thanks for catching this. Thanks, Yanan
r~ .
[Prev in Thread] | Current Thread | [Next in Thread] |