From patchwork Mon Sep 25 15:10:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13397970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 488B4CE7A81 for ; Mon, 25 Sep 2023 15:11:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qknEV-0008M7-Bk; Mon, 25 Sep 2023 11:10:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEM-0008EK-Pu for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:39 -0400 Received: from mout.kundenserver.de ([212.227.126.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEJ-0005L7-Se for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:38 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M1q8m-1qn09f0wPI-002DAX; Mon, 25 Sep 2023 17:10:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Markus Armbruster Subject: [PATCH 1/5] linux-user/flatload: clean up local variable shadowing Date: Mon, 25 Sep 2023 17:10:25 +0200 Message-ID: <20230925151029.461358-2-laurent@vivier.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925151029.461358-1-laurent@vivier.eu> References: <20230925151029.461358-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:YdvWlxSvsFN88bfFbM0ccbntFQ0A59rQm2QYYKbqbhkWX16UNYD 43cZWRw9ABvmyBjHDyAhl1TK+0sFSDpRUWGP/oe4kTEXPx7IUbNggosuwz0MKzrZyOqeDyo 1x1IOKcuR4Bz89yfBoEqGL7rC9wSegJFMY5t10YUe6A2TwsyOAqvjBZxsBwlMfkXagIk5x0 6hTHcH16PJI/HtKbRUMKA== UI-OutboundReport: notjunk:1;M01:P0:5VUufdgRljs=;kK2EZH0HXsWVJqMrOKN49sJSfFN L/Bj6ceIj3Py/q/+GLTpPJFWxd1jMjdmNbhlGtx7/DzUOanyCGHPd0Zks+M6qFeV/MW6getsZ tzbQE//vBdBSlhf7/mfhsIfrnMk1lCvBPDFUR0zFmYLpbKZAvkIzjWwJNc02w3MuiaUwELVKu JhVWpCOF/zR9e4qh4RpoNu09nnmpZxXNfj/W8ZZaTKFbvB5tS8KNkkb22ghh9koohBm+ZYzft fcM8HPESV/ubgtPfW2Lk9oje9Yo7kHZAEbOqYsC6XjyZMKmb4637TiUAj4ZnCyrCuHcREUHR1 DULsRS7LSORQFchodLX5jLqlzdFJOfYvlWTMNmXYHqPV5XgDlqzqKHZGIlV+uHr6hfQEs8a1t QYNTt2clpT3i2gl9dbJnl5OMiksCUJnVe+obZaSHu2YOm1XxuNseTZP8jEnnQWPsjIwIjW3Y3 k0kYlF5CXYDW9Kzrq1saWDCFWQNLNH18IN8u7mDAE95vqknosh02elvbmlGWMlXzDZpjw4aDV elDD/0AZZJ94FrBBFMLD0OC2aXgSglUE7HWRRHaP3KYkln1ySS+OMtV5sBQOFxYaiwuzozUas ap9XCsiWSqiLnSrYLz8vgXPbEuDEyu59K1UeEYCaiUK6OHPqsrKOEEYWSeo3HkKSuEpIk82oi msrM/hlF5tQcvg/ag5WwBZFzH0zGT2aFmKI8NC4byXwpztJVSfBQLXAE9L+VnBOeyXYFHWYrd +6IonbiWAvrPpVH+lZFj+30kQDr/kc3O6o7maP34j0FoaY2W00P1lxQ9wLH5DtuFN7qTXmO3L 9tesst/7pClAn/c5VZNJxuSkRp8DkIVLFZU6JTz5qJN8hsjvkC+WaPMxr4TRv74mDgGos97Vq LmIGfn9HxSwIEbw== Received-SPF: none client-ip=212.227.126.130; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Fix following warnings: .../linux-user/flatload.c: In function 'load_flt_binary': .../linux-user/flatload.c:758:23: warning: declaration of 'p' shadows a previous local [-Wshadow=compatible-local] 758 | abi_ulong p; | ^ ../../../Projects/qemu/linux-user/flatload.c:722:15: note: shadowed declaration is here 722 | abi_ulong p; | ^ Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth --- linux-user/flatload.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/flatload.c b/linux-user/flatload.c index 4331a11bf010..fdcc4610fa30 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -755,15 +755,15 @@ int load_flt_binary(struct linux_binprm *bprm, struct image_info *info) /* Update data segment pointers for all libraries */ for (i=0; i X-Patchwork-Id: 13397967 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 576B9CE7A81 for ; Mon, 25 Sep 2023 15:11:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qknER-0008H7-HH; Mon, 25 Sep 2023 11:10:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEM-0008Dm-0C for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:38 -0400 Received: from mout.kundenserver.de ([212.227.126.135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEJ-0005L8-T4 for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:37 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MsI8Y-1reHCH2iHC-00tlIJ; Mon, 25 Sep 2023 17:10:31 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Markus Armbruster Subject: [PATCH 2/5] linux-user/mmap.c: clean up local variable shadowing Date: Mon, 25 Sep 2023 17:10:26 +0200 Message-ID: <20230925151029.461358-3-laurent@vivier.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925151029.461358-1-laurent@vivier.eu> References: <20230925151029.461358-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:erE6zJTlpjDiXfdnlwGTTJmuFc+uYzYlwxb8zhNpZV4gG0dAQFu UVFb5ybU3oZaHZGgz00VRxCg6l2EUlrNt8tI4jBs4bV6EdVa5zYJbGFt0ry1qoAsf0EyJrs oMs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212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Fix following warnings: .../linux-user/mmap.c: In function 'target_mremap': .../linux-user/mmap.c:913:13: warning: declaration of 'prot' shadows a previous local [-Wshadow=compatible-local] 913 | int prot = 0; | ^~~~ ../../../Projects/qemu/linux-user/mmap.c:871:9: note: shadowed declaration is here 871 | int prot; | ^~~~ Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth --- linux-user/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 8eaf57b208b0..8ccaab78590f 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -910,16 +910,16 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, } } } else { - int prot = 0; + int page_flags = 0; if (reserved_va && old_size < new_size) { abi_ulong addr; for (addr = old_addr + old_size; addr < old_addr + new_size; addr++) { - prot |= page_get_flags(addr); + page_flags |= page_get_flags(addr); } } - if (prot == 0) { + if (page_flags == 0) { host_addr = mremap(g2h_untagged(old_addr), old_size, new_size, flags); From patchwork Mon Sep 25 15:10:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13397968 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 19106CE7A81 for ; Mon, 25 Sep 2023 15:11:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qknEU-0008Je-B1; Mon, 25 Sep 2023 11:10:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEM-0008Dq-9G for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:39 -0400 Received: from mout.kundenserver.de ([212.227.126.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEK-0005LB-Cw for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:38 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MgNMV-1rJ3aR0KHn-00htAs; Mon, 25 Sep 2023 17:10:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Markus Armbruster Subject: [PATCH 3/5] linux-user/syscall.c: clean up local variable shadowing in do_ioctl_dm() Date: Mon, 25 Sep 2023 17:10:27 +0200 Message-ID: <20230925151029.461358-4-laurent@vivier.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925151029.461358-1-laurent@vivier.eu> References: <20230925151029.461358-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:xjUKcxF5dVPOhm09IN9+CEoO6jTC//sS6ONqZJTuCQ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ZQOCvunWyumL/i3Nyt8is6SHr/8IvdWlvWXBisg0 Kx7Mpkh8rtgrkqA== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Fix following warnings: .../linux-user/syscall.c: In function 'do_ioctl_dm': .../linux-user/syscall.c:5053:23: warning: declaration of 'arg_type' shadows a previous local [-Wshadow=local] 5053 | const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) }; | ^~~~~~~~ .../linux-user/syscall.c:4991:20: note: shadowed declaration is here 4991 | const argtype *arg_type = ie->arg_type; | ^~~~~~~~ ...//linux-user/syscall.c:5102:27: warning: declaration of 'arg_type' shadows a previous local [-Wshadow=local] 5102 | const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_name_list) }; | ^~~~~~~~ .../linux-user/syscall.c:4991:20: note: shadowed declaration is here 4991 | const argtype *arg_type = ie->arg_type; | ^~~~~~~~ .../linux-user/syscall.c:5130:27: warning: declaration of 'arg_type' shadows a previous local [-Wshadow=local] 5130 | const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) }; | ^~~~~~~~ .../linux-user/syscall.c:4991:20: note: shadowed declaration is here 4991 | const argtype *arg_type = ie->arg_type; | ^~~~~~~~ .../linux-user/syscall.c:5170:27: warning: declaration of 'arg_type' shadows a previous local [-Wshadow=local] 5170 | const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_versions) }; | ^~~~~~~~ .../linux-user/syscall.c:4991:20: note: shadowed declaration is here 4991 | const argtype *arg_type = ie->arg_type; | ^~~~~~~~ Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth --- linux-user/syscall.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 3521a2d70b00..c81e8d344486 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5050,8 +5050,8 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, { void *gspec = argptr; void *cur_data = host_data; - const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) }; - int spec_size = thunk_type_size(arg_type, 0); + const argtype dm_arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) }; + int spec_size = thunk_type_size(dm_arg_type, 0); int i; for (i = 0; i < host_dm->target_count; i++) { @@ -5059,7 +5059,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, uint32_t next; int slen; - thunk_convert(spec, gspec, arg_type, THUNK_HOST); + thunk_convert(spec, gspec, dm_arg_type, THUNK_HOST); slen = strlen((char*)gspec + spec_size) + 1; next = spec->next; spec->next = sizeof(*spec) + slen; @@ -5099,7 +5099,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, struct dm_name_list *nl = (void*)host_dm + host_dm->data_start; uint32_t remaining_data = guest_data_size; void *cur_data = argptr; - const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_name_list) }; + const argtype dm_arg_type[] = { MK_STRUCT(STRUCT_dm_name_list) }; int nl_size = 12; /* can't use thunk_size due to alignment */ while (1) { @@ -5111,7 +5111,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, host_dm->flags |= DM_BUFFER_FULL_FLAG; break; } - thunk_convert(cur_data, nl, arg_type, THUNK_TARGET); + thunk_convert(cur_data, nl, dm_arg_type, THUNK_TARGET); strcpy(cur_data + nl_size, nl->name); cur_data += nl->next; remaining_data -= nl->next; @@ -5127,8 +5127,8 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, { struct dm_target_spec *spec = (void*)host_dm + host_dm->data_start; void *cur_data = argptr; - const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) }; - int spec_size = thunk_type_size(arg_type, 0); + const argtype dm_arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) }; + int spec_size = thunk_type_size(dm_arg_type, 0); int i; for (i = 0; i < host_dm->target_count; i++) { @@ -5139,7 +5139,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, host_dm->flags |= DM_BUFFER_FULL_FLAG; break; } - thunk_convert(cur_data, spec, arg_type, THUNK_TARGET); + thunk_convert(cur_data, spec, dm_arg_type, THUNK_TARGET); strcpy(cur_data + spec_size, (char*)&spec[1]); cur_data = argptr + spec->next; spec = (void*)host_dm + host_dm->data_start + next; @@ -5167,8 +5167,8 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, struct dm_target_versions *vers = (void*)host_dm + host_dm->data_start; uint32_t remaining_data = guest_data_size; void *cur_data = argptr; - const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_versions) }; - int vers_size = thunk_type_size(arg_type, 0); + const argtype dm_arg_type[] = { MK_STRUCT(STRUCT_dm_target_versions) }; + int vers_size = thunk_type_size(dm_arg_type, 0); while (1) { uint32_t next = vers->next; @@ -5179,7 +5179,7 @@ static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd, host_dm->flags |= DM_BUFFER_FULL_FLAG; break; } - thunk_convert(cur_data, vers, arg_type, THUNK_TARGET); + thunk_convert(cur_data, vers, dm_arg_type, THUNK_TARGET); strcpy(cur_data + vers_size, vers->name); cur_data += vers->next; remaining_data -= vers->next; From patchwork Mon Sep 25 15:10:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13397971 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14522CE7A95 for ; Mon, 25 Sep 2023 15:11:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qknEZ-0008Ux-87; Mon, 25 Sep 2023 11:10:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEN-0008EL-6O for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:39 -0400 Received: from mout.kundenserver.de ([212.227.126.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEK-0005LI-Nz for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:38 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MJmX3-1r4OXp2F0T-00K9Ym; Mon, 25 Sep 2023 17:10:32 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Markus Armbruster Subject: [PATCH 4/5] linux-user/syscall.c: clean up local variable shadowing in TARGET_NR_getcpu Date: Mon, 25 Sep 2023 17:10:28 +0200 Message-ID: <20230925151029.461358-5-laurent@vivier.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925151029.461358-1-laurent@vivier.eu> References: <20230925151029.461358-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:cp5dII6cz88MTj0fA1R1qPDmWd1psJxUUAR6VVu3GthE25r/YIl TEs+hoOHlRnUjcnNPQFhXoz5lhb/Hm0O/T6afo8Sq+ROEcfF4k8wcVyadvRfjLjLApz6PtD mIGrXp6Z8A7KiTidIaW1DS5/NgvNR554049Ke/QC56enQZvmcwXpZxYS2LSt0VuT5ycBO3b 1BrEKA7LSVhmwmDdHUI8Q== UI-OutboundReport: notjunk:1;M01:P0:j471AQwSMtM=;vlXNSr11vhmXo9Cc37ngCW+XZcc Yv7dtsmGHUmyMibeo9nJ/a57/tI6EU2XVbt8wd7BHmTitfo6QZF105+dSe/+eJYaU6UoiyecS Rcl0ylyAyvPQC+L+v0VdyFvRQLGfFlSCQx8enM+U1K0CkYY5lq37I1Nd3hq0292eM5uHvOmuB ZVIwXxHzBOj4xT+EiGNYj6c9VkmMtj2+nu7VcNbctkEcsC1h4NtALpaYBYs0M02y4w5LWo2xd ufZqnISd4JpjyE4LR0+JRKeWeiJWbHRl2/c8eZ/AsvTjyeKPM2LyVJz6ZJ1ltoLCqaS9T1qyK KKrBZwM7wzdGAjo9npyavZ7QNv5bg+Y8hVPSoUFqxPJ3D59WAyHPNb46YN1AGdXIIa9IrwUEt oJwM5wI64i5YrtECoDDm2aQTT6yOK/iRCUvezR61r1XJnPysWJe5QmkhYAURrORamH6BRkbWt qyueo7EcAo3e8EBexsbZDJzaSCLIlhHoZxaWCuziq0eGoKBg6O1urU4gHCBxxQ6yW31MQ1bKQ ITQm03JWfAMOhWhcXvGY5XfkItxlJLU2iXmRF5hBGPu4kHpQHluMmMvUh9Ja3C/AMgJyR2hYd XPghZZTJG7zgDCvXCUvDUqZEfGKDgHE8CpQRrnBtCTxk09YAQ+X3ztRxll8/QHBLL/VVV2Qjp GiF6s8EVJb4tHNQuL66gf1SsrtAS+LtYt88y8S93poNNfhjHgrBiYpH10AiTPwaAuN2CiF+0Z 6xxP9cC6LSjAZ3rXZg57Mf1g0qDTDrqTx5ECADsBkwFToTILdIYHYnGhLH7pmvJllTnHwYaY8 idiXQY/XA1WMl0ldEKuqZF7VkyEQYta5lR9F1srmscwH4Z0/fWQE1FSQiHdhd+AG7a88KwyCd nn28P1/3fX9fQ5w== Received-SPF: none client-ip=212.227.126.134; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Fix following warnings: .../linux-user/syscall.c: In function 'do_syscall1': .../linux-user/syscall.c:11180:22: warning: declaration of 'cpu' shadows a previous local [-Wshadow=local] 11180 | unsigned cpu, node; | ^~~ .../linux-user/syscall.c:8963:15: note: shadowed declaration is here 8963 | CPUState *cpu = env_cpu(cpu_env); | ^~~ Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth --- linux-user/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c81e8d344486..6139c00ddceb 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11177,14 +11177,14 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, } case TARGET_NR_getcpu: { - unsigned cpu, node; - ret = get_errno(sys_getcpu(arg1 ? &cpu : NULL, + unsigned cpuid, node; + ret = get_errno(sys_getcpu(arg1 ? &cpuid : NULL, arg2 ? &node : NULL, NULL)); if (is_error(ret)) { return ret; } - if (arg1 && put_user_u32(cpu, arg1)) { + if (arg1 && put_user_u32(cpuid, arg1)) { return -TARGET_EFAULT; } if (arg2 && put_user_u32(node, arg2)) { From patchwork Mon Sep 25 15:10:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13397969 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48A2CCE7A96 for ; Mon, 25 Sep 2023 15:11:35 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qknEa-0008Vo-An; Mon, 25 Sep 2023 11:10:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEN-0008EM-78 for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:40 -0400 Received: from mout.kundenserver.de ([212.227.126.135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qknEK-0005LK-PT for qemu-devel@nongnu.org; Mon, 25 Sep 2023 11:10:38 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MrhDg-1rPL6j03Ay-00ngzd; Mon, 25 Sep 2023 17:10:33 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: Laurent Vivier , Markus Armbruster Subject: [PATCH 5/5] linux-user/syscall.c: clean up local variable shadowing in xattr syscalls Date: Mon, 25 Sep 2023 17:10:29 +0200 Message-ID: <20230925151029.461358-6-laurent@vivier.eu> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230925151029.461358-1-laurent@vivier.eu> References: <20230925151029.461358-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:MeBvzcuRUut/buWI4k9XUOj5/7wB04NFKeVVJcc28GoEL/8JGH7 f7CbFXXJCa1NN8/SeJu0UCOT6Q/1zEu+BZFk6PHwu30GiLEey2Z1B6EWBbVPHybVjm42AEw T70NylaldAHhEzI6MYSLk7jNixtgzVDu0ixJCi2+1mfOrak0aJsHWfjFznezlJleBt8QzxI axg5Q7Hr4dKoDESARzenQ== UI-OutboundReport: notjunk:1;M01:P0:dIIA/VoiAXk=;V6hQuhSHhDMwzhtUtsjyeKStpap +Xje+ocLntqCWBd51UHQVmQ8xvX+WvB2wDp0q4Wu1Ug/fjECwCevScHCP4VsPvQ4hyeJ/YYXX BmcovOSPOdIS6hxC3KsCBEp7/YOVwrFHk6gEczdS9K0kMhMILsFf7Xk7nzEB53uhEmxH1VLeM DJ3Ee4zL/xyeujVAzDz4l+LRQwjEpm2D3kTn4nEMX1khIFenWx0IIfpTeQpaV166AxKUw9eR3 58yiR9JLcg6jPciEali5+3eADSUSkTjyVG1dgR1YR5IWxkpwwoSh7Ped7UYI47164Z5udX+ue 5zdyawl+iosoRRCQ+i8XgIWXT8qE1AERmLo2Qi9dA7XMCLEpk8xbgTUWQLX1cp6NP9XhJcIm7 ve6qegNBtWs0p6PO0K/FzlL2webzUub+gJgf3GwW4EHqKP2tLFrnH1h7tp9ZFWseEcDpsSmPW Xb5i4zGRIO4i1Euevk7r0uOzRROBbws0uk41SIorebNVwlnenliWrGr9hZgp++iq1jJFF83Aw t3lS5HFH2Pv0C9d4OCecVWCwBi19XgZnad4Y2xtWTqQABKJYqizz1QQ7UxmxUTO5C+0808r7V VdlcvWtKu/av7zSFA53kGMPJKs1dgw4wcefc73mR2qO0nXSS/EWGj+4kb1YKqqZSHrY9Mixnz I3FtUNm95w+C4zUWvxEss96zwxgLlxkkbcz1RQsB/OzmPIBw2i8ET6uuD4JNqkROS4SOmgZlc ApX7/YrQ7qpLCiCenWX6eJafX4Lm6URqdvDwxbPUf8YEWyu6YE9ha5Oxg1cgNrs1TBhP8QLWT OJ4HXAJ+MTkIL21FPq1xZmAIvDqN2StR0d3dWePPGnKjVcXFQuJcXSD2QhIQTcp6guxgLn6bO 32B89+vO6pBCkTg== Received-SPF: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org p is a generic variable in syscall() and can be used by any syscall case, so this patch removes the useless local variable declaration for the following syscalls: TARGET_NR_llistxattr, TARGET_NR_listxattr, TARGET_NR_setxattr, TARGET_NR_lsetxattr, TARGET_NR_getxattr, TARGET_NR_lgetxattr, TARGET_NR_removexattr, TARGET_NR_lremovexattr. Fix following warnings: .../linux-user/syscall.c:12342:15: warning: declaration of 'p' shadows a previous local [-Wshadow=compatible-local] 12342 | void *p, *b = 0; | ^ .../linux-user/syscall.c:8975:11: note: shadowed declaration is here 8975 | void *p; | ^ .../linux-user/syscall.c:12379:19: warning: declaration of 'p' shadows a previous local [-Wshadow=compatible-local] 12379 | void *p, *n, *v = 0; | ^ .../linux-user/syscall.c:8975:11: note: shadowed declaration is here 8975 | void *p; | ^ .../linux-user/syscall.c:12424:19: warning: declaration of 'p' shadows a previous local [-Wshadow=compatible-local] 12424 | void *p, *n, *v = 0; | ^ .../linux-user/syscall.c:8975:11: note: shadowed declaration is here 8975 | void *p; | ^ .../linux-user/syscall.c:12469:19: warning: declaration of 'p' shadows a previous local [-Wshadow=compatible-local] 12469 | void *p, *n; | ^ .../linux-user/syscall.c:8975:11: note: shadowed declaration is here 8975 | void *p; | ^ Signed-off-by: Laurent Vivier Reviewed-by: Thomas Huth --- linux-user/syscall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6139c00ddceb..fe228f7db3a7 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -12339,7 +12339,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, case TARGET_NR_listxattr: case TARGET_NR_llistxattr: { - void *p, *b = 0; + void *b = 0; if (arg2) { b = lock_user(VERIFY_WRITE, arg2, arg3, 0); if (!b) { @@ -12376,7 +12376,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, case TARGET_NR_setxattr: case TARGET_NR_lsetxattr: { - void *p, *n, *v = 0; + void *n, *v = 0; if (arg3) { v = lock_user(VERIFY_READ, arg3, arg4, 1); if (!v) { @@ -12421,7 +12421,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, case TARGET_NR_getxattr: case TARGET_NR_lgetxattr: { - void *p, *n, *v = 0; + void *n, *v = 0; if (arg3) { v = lock_user(VERIFY_WRITE, arg3, arg4, 0); if (!v) { @@ -12466,7 +12466,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, case TARGET_NR_removexattr: case TARGET_NR_lremovexattr: { - void *p, *n; + void *n; p = lock_user_string(arg1); n = lock_user_string(arg2); if (p && n) {