From patchwork Sat Jun 10 06:57:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 691163 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1172617wru; Sat, 10 Jun 2023 00:00:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7LqVsHckAo5XX1In2E//fURyj3xNFJx0cm8zPHu509OOsq6wXbF1OENA/tSWt9fzH4t710 X-Received: by 2002:a0d:c482:0:b0:559:e235:5f65 with SMTP id g124-20020a0dc482000000b00559e2355f65mr3347312ywd.37.1686380430428; Sat, 10 Jun 2023 00:00:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686380430; cv=none; d=google.com; s=arc-20160816; b=OEx9Wwq5a432FLduAWL/GM+tFzSkceQNR4oyJHwSI41pt48nLtno44zkKsMc6aVFcE GBffEEMJVVXVcfqfoc5EcM4cLRONXlb6aboHN8yOtAuNyoM2IWsMMJD759kbKQnq1m6G Y2rtWn9BI6mFIHxQweFjbX9CKzJ22oFWc2HBIsRNToqs8ISBbgthMTrhVPnZ9e//opim LMla141ALjIaFJ3BnR1htzUeF8ZnUCRXRofC3kHsvZzzzeJ1TFNR5xtkmXNfViN7GtQO zJHOXFALf4XOgtF4bg9SYnfCTh05NYgkgGBuQ0ftD/5T1bX4S13VCqe4Yj2ZXAFnXyg8 Sx2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=xiAZddILQlzT4Aftp/FyS5mJFFXofqJjff+HJEAN+68=; b=g+bIsU746omeMvvtHf+NE/voUW7Nh+p7/trLZyqBl+DGH+WN6BcjpZP+xuvuwYrf/9 oTb/5ux65jkMK8hVqdQ+n5syVLJmjP8D80tP8bzFLG5JNs+wl+iLpNZr1PMYlN43rp9u 9AvDXh2R4vQMvyRa8g7NYt/Ukw1uE8ln6KVTChETif3gzdbhUx3kfYoqdlfCc9JT0ORv XQ22vs9k2l+gg9FPYtg2Sdq7wTwRMjDOA4eRHN+DI3qzzN3r6JltbAeV7s5XvML9POqy cdw7V8mvwZUMNwfjsbFo7n7xpxv0g18+lm6S9ZCf6aMpBckq17O2NGynlvfeF8hoWONT dK5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h19-20020a37de13000000b0075b0deeb407si3102275qkj.764.2023.06.10.00.00.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jun 2023 00:00:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7sYG-0002lM-HG; Sat, 10 Jun 2023 02:58:21 -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 1q7sYC-0002k1-K4; Sat, 10 Jun 2023 02:58:16 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7sYB-0005wS-32; Sat, 10 Jun 2023 02:58:16 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id AA78EBE27; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 1E2F4B294; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: (nullmailer pid 1107514 invoked by uid 1000); Sat, 10 Jun 2023 06:57:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Richard Henderson , Michael Tokarev Subject: [PULL 07/16] target/m68k/fpu_helper: Use FloatRelation enum to hold comparison result Date: Sat, 10 Jun 2023 09:57:45 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Use the FloatRelation enum to hold the comparison result (missed in commit 71bfd65c5f "softfloat: Name compare relation enum"). Inspired-by: Cédric Le Goater Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Michael Tokarev --- target/m68k/fpu_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c index 3a37d8f584..ab120b5f59 100644 --- a/target/m68k/fpu_helper.c +++ b/target/m68k/fpu_helper.c @@ -349,7 +349,7 @@ void HELPER(fsgldiv)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1) PREC_END(); } -static int float_comp_to_cc(int float_compare) +static int float_comp_to_cc(FloatRelation float_compare) { switch (float_compare) { case float_relation_equal: @@ -367,7 +367,7 @@ static int float_comp_to_cc(int float_compare) void HELPER(fcmp)(CPUM68KState *env, FPReg *val0, FPReg *val1) { - int float_compare; + FloatRelation float_compare; float_compare = floatx80_compare(val1->d, val0->d, &env->fp_status); env->fpsr = (env->fpsr & ~FPSR_CC_MASK) | float_comp_to_cc(float_compare); From patchwork Sat Jun 10 06:57:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 691162 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1172584wru; Sat, 10 Jun 2023 00:00:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7S+77qhBIHYiJ4KkBn7FreC27KYWttPKAV9twO6bciilHZxFm6k7DPGKCOdvcuOU8uu0b3 X-Received: by 2002:ac8:59cd:0:b0:3f7:7cce:62c9 with SMTP id f13-20020ac859cd000000b003f77cce62c9mr4061296qtf.12.1686380425755; Sat, 10 Jun 2023 00:00:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686380425; cv=none; d=google.com; s=arc-20160816; b=e8Q3dOEURXdoLxp4n1R6y7femgkph3e1H7QSRaRjIWm84d1uAQIPH+M4oqRFPs714q gK2jYSWN6Z+flHs9IpnVvEaHf1KpC3PkvK43t7mqWnJUOPtQMHZfaAqCNkRNisYWXmCb J0qP88oABOmenrIMlQp44ggsNIY0Ysnj5jHRZ0ukGqAQUlL0xE0XM+2RO5zJQwnYSNkN jvqj8rSnvTNZN/iul8ElP3SX/kdjK0kxaOyFt2Ma5HO1RgzwkfNA8Sq79Q+xlgLpukbk xUXol14b37WainywTvrhb5Aky6qL7xtqZwQSXj7oCiIZ0/uRJxR0xdrIie/ZSdSQvy8Z 2nhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=iZhbpGj9Kx3vM8ByNePafb1SdAezFg9j2hxkX0ZC3iI=; b=o7J1EZdB0YhTmlJl8kaILEqioq5n62dW107VONqGbDKgwJJM0Cb4fL97R17WiHI9er vTs9UqRA1kgTB2FoDQiSp1vN2e59gfGotfF2ujM/Ez7LV4rkyiBBWCMWYRQRI3rANP4M bJwlDLP3xiuFc5g9INrypYh7V+FEq8jhMrSRn4Dd1QyLFvjuolR3GVBLjXWIShxRfOHt ejM8EJqVEmvttEpcKdpODE9VJQhsNyXbeoV9V1Uc11evgkaDiYpWMrpwwj/iBSH1AKgI YI+63G5GfjRU0Wct00+oS59E08NoTc2IqTJNfOv1swr5r4RArpna/qyrJOCfaTA0+gdE +NkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o17-20020a05622a139100b003f9a82fcbb5si3030533qtk.75.2023.06.10.00.00.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jun 2023 00:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7sYk-0002sv-1z; Sat, 10 Jun 2023 02:58:50 -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 1q7sYH-0002lQ-DO; Sat, 10 Jun 2023 02:58:21 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7sYC-0005wg-MY; Sat, 10 Jun 2023 02:58:21 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id D9D59BE28; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 6BBBEB295; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: (nullmailer pid 1107517 invoked by uid 1000); Sat, 10 Jun 2023 06:57:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, Richard Henderson , Michael Tokarev Subject: [PULL 08/16] hw/core/cpu: Simplify realize() using MACHINE_GET_CLASS() macro Date: Sat, 10 Jun 2023 09:57:46 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Michael Tokarev --- hw/core/cpu-common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index f4e51c8a1b..ced66c2b34 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -196,8 +196,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) * no need to check the ignore_memory_transaction_failures board flag. */ if (object_dynamic_cast(machine, TYPE_MACHINE)) { - ObjectClass *oc = object_get_class(machine); - MachineClass *mc = MACHINE_CLASS(oc); + MachineClass *mc = MACHINE_GET_CLASS(machine); if (mc) { cpu->ignore_memory_transaction_failures = From patchwork Sat Jun 10 06:57:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 691161 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1172489wru; Sat, 10 Jun 2023 00:00:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5641bXnnJUuEfEJMlEOrVUOfBIDtYKTfaMLRMZ9+Eda2n2sUIzs2NEt4oTxYLYjBm5SAVl X-Received: by 2002:a05:622a:1887:b0:3f9:bbb6:b566 with SMTP id v7-20020a05622a188700b003f9bbb6b566mr4877099qtc.1.1686380413497; Sat, 10 Jun 2023 00:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686380413; cv=none; d=google.com; s=arc-20160816; b=dCpmziY+IgDBfsX6pc2Kg0ixSMijDA/nAxfGxbOQJRPsHmtO0ACdIjllAy5Y8nALPJ u5h8VBhnXxLDJcOlv6KRLUC9bGwyKcF0oVFwJGbjn8xC7MFIS/g160cP4DGFEURaeole VWxsUcSFrVS/qpct3AILRXUQpxXJfoylzPwgIWRyXevbDQOv8tlRdMKtvO0S+KN13iVh dNDMWnR+B/h4oZxyp7ue+mZ0YC7SyzGjAVIn4LAXDC8KL08HmUD4oEldv3QgHbnx/3J7 VIJr6hNyUIIxWdId+9Lo7cW6EpQSLqQP03iSARPNMZ8Ha7DYcmxIKezT+7SzXvFuLVHx KI4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=7M5DZ/QD20DPt8ftVBw0MDktbaJHPtxJfFXaxEWm9vQ=; b=aUvYQdVlRFl6YxGR7l9XMslS7GOo6GlF76Ky20jLeUkxy9VxmunVAIYE+yZmjxUf63 T3LRpb8IXwSXSrxkTiXuv3w8mmhsFM34kMeqCGqYXwTievJ53gpuy3rrd8OI3BBqO9Li 10bBw0OZCjxi6zxExBMOsGB6pewtzoaBW8KBXppQtghht3qlbXGFgD0MSh2iN2MnND9p yVreo7VzRIYnyPdxn37Aqmor7ztiorsHUbQEjj7qvK1PMk192B0HuwDty0pJxXNrYcsz IQqX5TN+4TYR4pKUt5mzrO7IDkC4XTRfSLLO1kHuF+p+3dothYyqP7ZdGiMoq5qXGXPx gUhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q14-20020a05622a030e00b003eca9c6d28csi3309048qtw.650.2023.06.10.00.00.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jun 2023 00:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7sYi-0002mN-4q; Sat, 10 Jun 2023 02:58:48 -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 1q7sYF-0002lP-OS; Sat, 10 Jun 2023 02:58:20 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7sYE-0005wv-AH; Sat, 10 Jun 2023 02:58:19 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 11BC4BE29; Sat, 10 Jun 2023 09:58:01 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 9B253B296; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: (nullmailer pid 1107520 invoked by uid 1000); Sat, 10 Jun 2023 06:57:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, Richard Henderson , Sergio Lopez , Michael Tokarev Subject: [PULL 09/16] hw/i386/microvm: Simplify using object_dynamic_cast() Date: Sat, 10 Jun 2023 09:57:47 +0300 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Use object_dynamic_cast() to determine if 'dev' is a TYPE_VIRTIO_MMIO. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Sergio Lopez Signed-off-by: Michael Tokarev --- hw/i386/microvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 3d606a20b4..7227a2156c 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -389,9 +389,8 @@ static void microvm_fix_kernel_cmdline(MachineState *machine) bus = sysbus_get_default(); QTAILQ_FOREACH(kid, &bus->children, sibling) { DeviceState *dev = kid->child; - ObjectClass *class = object_get_class(OBJECT(dev)); - if (class == object_class_by_name(TYPE_VIRTIO_MMIO)) { + if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MMIO)) { VirtIOMMIOProxy *mmio = VIRTIO_MMIO(OBJECT(dev)); VirtioBusState *mmio_virtio_bus = &mmio->bus; BusState *mmio_bus = &mmio_virtio_bus->parent_obj; From patchwork Sat Jun 10 06:57:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 691159 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1172281wru; Fri, 9 Jun 2023 23:59:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6opv28qGJABHLxJkSaFYIe8sA+SZM3sN+0SGWMw0sKyENOQ1Mr6dEHcv2bBZcFHBo6/Pdu X-Received: by 2002:ad4:5aeb:0:b0:62b:4590:78d6 with SMTP id c11-20020ad45aeb000000b0062b459078d6mr4187471qvh.25.1686380365739; Fri, 09 Jun 2023 23:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686380365; cv=none; d=google.com; s=arc-20160816; b=NNbOFdYS7+niaN+2WI0Gyu7fs50dSY81s6OZTJKeFVEA/jjF29x5QPxot159Vz/PbP V+eDsAU+rYEikKVHpoTOs9R1Wpzx9z59PyZCoNACoa2QhT7Lk33Jqwhu7pQkPheAfX+u 2V/AkFsccYPAutiHGdaKw8goBdWx1QSjSfBz1m/H4WoZyxIWU39kRHcoP9ihK37zfh0K esTVgUjVr2qlwPvKC+450mkAlWyjgbTW3axlca491qyH2IAAI003sMUlF5ykQXU8s3aD nJw9fr74+xVaWW19uaPijG31pJSKj42hgVWDpHcp+KI2uQKeYbihK2xNHt34lXKb03K+ nNPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=EKctaWaPUx8z+IdN2jTOqV27tsVr+xUuritqnoueOkk=; b=gNNM1SH4hVWPcQ0IDrEvDxeszoyOKtPxinzwRslZW88WymGNGd8Qy38doQrYXRKlla lvgDfQyiCr3SnvU9t95ufD6sHP0gkk5clV8BD8V6qzN3Ag0Z0fOND270Qd2+Of1H3/cF aOigl6DQKbMQ5Ex3bBR1nUXPxHEE6MTd3lWxeUx/oAXA2/JhtbDugr9G97UzmrraSZTY I8Kf3L/RT6/WhrsYWc6Sg7NvavPlRBY/9vbM0oOO5ZA90WTQJGNomBOic5s9o2Y1kTqV 3ElWcYYuqTWgqvDKLpJ0RCFDz8k3RqV/qmoHgjXBChcfC8E9wYmLfkkjqM64zJL6Bavi JpBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o7-20020ad45c87000000b0062576870bd1si3634107qvh.498.2023.06.09.23.59.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Jun 2023 23:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7sYj-0002si-Ru; Sat, 10 Jun 2023 02:58:49 -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 1q7sYJ-0002lh-NW; Sat, 10 Jun 2023 02:58:25 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7sYH-0005xD-54; Sat, 10 Jun 2023 02:58:22 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 344FDBE2A; Sat, 10 Jun 2023 09:58:01 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id C73FFB297; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: (nullmailer pid 1107523 invoked by uid 1000); Sat, 10 Jun 2023 06:57:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, Richard Henderson , Michael Tokarev Subject: [PULL 10/16] hw/pci/pci: Simplify pci_bar_address() using MACHINE_GET_CLASS() macro Date: Sat, 10 Jun 2023 09:57:48 +0300 Message-Id: <271233f21f66c10194a45c1bff1db61fe2694a22.1686379708.git.mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Remove unnecessary intermediate variables. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Michael Tokarev --- hw/pci/pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 9b7b4d7c18..bf38905b7d 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1446,9 +1446,7 @@ pcibus_t pci_bar_address(PCIDevice *d, { pcibus_t new_addr, last_addr; uint16_t cmd = pci_get_word(d->config + PCI_COMMAND); - Object *machine = qdev_get_machine(); - ObjectClass *oc = object_get_class(machine); - MachineClass *mc = MACHINE_CLASS(oc); + MachineClass *mc = MACHINE_GET_CLASS(qdev_get_machine()); bool allow_0_address = mc->pci_allow_0_address; if (type & PCI_BASE_ADDRESS_SPACE_IO) { From patchwork Sat Jun 10 06:57:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 691160 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1172410wru; Sat, 10 Jun 2023 00:00:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4vgS0HEW6MhwUTmvfpCop0Gg//Oq3+b2NWKftON0N4dZDrcHUrrgmIEbybUnslYVT76uL1 X-Received: by 2002:a05:620a:2441:b0:75b:23a1:3632 with SMTP id h1-20020a05620a244100b0075b23a13632mr4712088qkn.67.1686380400472; Sat, 10 Jun 2023 00:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686380400; cv=none; d=google.com; s=arc-20160816; b=b4/0ZOii3abD/BK+1yUdvHjL8qSmO5QlLtEVv22unX9+FVyg/RvYHqTYD2zvDiNEzc 9+WmgvIsbGGKfRWt61+x92qrhxiaByUFRF/hDtiijrzdhHJHbjSNYeemLah5dZLAP8BO XnBk0zKLKaMz6KL9ctOtuSN4yfYguCqBpEugEkGvLMwT2NXUqnFrJ9DASKRyCEsFsana 3fOhN705Y09uStYRqjSkHzw7pHUo9s0uhqGJnjTM1KJVkXrDQHN7NU6dSdYMhr5+/1x+ twnzb8LnO/GDrKWP0SgDVyU2FYL8rcxWaVzQs7WXjX/VkXRsI/HwTzwfLkbjGN3BvyBm 4WdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=2NA5+uyI3mdTQVFukklYEDJFqzbQK8JrOdvYp/So6CM=; b=fZfmNM2P08kMKb382ItBUnyO12l9ghsK54VLAn96gCzZuF3p0ILv2OWU5g98BKDqwk 75SUxnJZvpCQNa1gjk8ZctN0giHJ0E4dP2/qxLc4Mu3mPpegBCSpTH243gByV0YqnW8P YMvT0owLhpxFDu6c8AJLq+RUSQ97x4Ewkka9DTD0il77KbTjoXdro0RE1b2Fb4CpgPME fiwxmHHBsGCtrF/rVqrOISCk7UH6KRl3mb1jDgT/+HoW25If9YK2xEXvcbRuOBj7fmHc uAIlZDsS2Feurh/OOH71nIbUc9yN7tfcLDmulCDyW0nVVzvUBRQnumH/Z0Zj30g8UJD0 UNUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pj1-20020a05620a1d8100b0075cf5c73f94si3124746qkn.772.2023.06.10.00.00.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 10 Jun 2023 00:00:00 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7sYq-0002yQ-Cn; Sat, 10 Jun 2023 02:58:56 -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 1q7sYf-0002oj-Co; Sat, 10 Jun 2023 02:58:47 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7sYd-0005xT-Pt; Sat, 10 Jun 2023 02:58:45 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 6D38ABE2B; Sat, 10 Jun 2023 09:58:01 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id E9CA9B298; Sat, 10 Jun 2023 09:58:00 +0300 (MSK) Received: (nullmailer pid 1107526 invoked by uid 1000); Sat, 10 Jun 2023 06:57:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-trivial@nongnu.org, Richard Henderson , Michael Tokarev Subject: [PULL 11/16] hw/usb/hcd-ehci-pci: Simplify using DEVICE_GET_CLASS() macro Date: Sat, 10 Jun 2023 09:57:49 +0300 Message-Id: <4c030dd00f617b432524f7f9627192cb9b328bcb.1686379708.git.mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Michael Tokarev --- hw/usb/hcd-ehci-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/hcd-ehci-pci.c b/hw/usb/hcd-ehci-pci.c index 4c37c8e227..345444a573 100644 --- a/hw/usb/hcd-ehci-pci.c +++ b/hw/usb/hcd-ehci-pci.c @@ -74,7 +74,7 @@ static void usb_ehci_pci_realize(PCIDevice *dev, Error **errp) static void usb_ehci_pci_init(Object *obj) { - DeviceClass *dc = OBJECT_GET_CLASS(DeviceClass, obj, TYPE_DEVICE); + DeviceClass *dc = DEVICE_GET_CLASS(obj); EHCIPCIState *i = PCI_EHCI(obj); EHCIState *s = &i->ehci; From patchwork Sat Jun 10 06:57:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 691158 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d8a:0:0:0:0:0 with SMTP id b10csp1172279wru; Fri, 9 Jun 2023 23:59:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ONrS3dZ9hNWIxeXQdCkoq761Rc+mOS977bx7URYOjPyA0Vylcmie1L2Zf9JdegeqTPJim X-Received: by 2002:ad4:5f4d:0:b0:626:94f:6044 with SMTP id p13-20020ad45f4d000000b00626094f6044mr4437662qvg.2.1686380365378; Fri, 09 Jun 2023 23:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686380365; cv=none; d=google.com; s=arc-20160816; b=E4d66aPGpQoSYWtDuH7abyThsNCAxoyzcJw3eI/TiqVQ9sqH8AcNgqNqRIhUhLaMQ1 Gms9pj4wixwyuctWYtjZWTXs6NML/VZsshEO/JMdWj4iOLrFmRB71wGIuWtLXQES93YP oJHzD1FApNxiwWx7WneYU9Ig4dQ7xFtse9Aj/gFy8xRYmYJpiIGOciPMbeyWCX7IEeUW WawCVrwaaFysOcY9wbgfkx12NgLyZ5vwtFrrDhbU56BS/LyQTQzjACIIcmCr9D8AlfTs 7vLJgu6a66cC6I5H+3mFVpBQoTz96wZXn0f1xA6dF+8wF5lRtAZCtAw+4Twpr948CheB E46w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=3YQErN2mMwe56l3gwaDUqlH0/MYeSA9u5P1AKn0grXU=; b=DMNtN2pcybREhWI+75fhqagfVGpZ8+imU/HLfFXcpA+ZBxIElMJif+HZCl3txc0FPM as3lEBUV5ioEOMZ5bWDqJgNBGaDv4hlc2O24hhS3zCGnwV6r1JGkEN9xoBVtXOeqqSGo Gkug7lhhWFtuJxFAtlDtzGQdN5l4ACcmvK4ORHU9MEk/KRoz4FB5oGVsD34b6qSo3vaQ nu8JFGdvFHJuQKywDpE/qBEGBRUZfeW0dqXl7bzXRE9wc41k+V67gpTxcOMnhlND2/s8 e9TP+pv/B85xwUTHzupO5HZ4FR53ZRlxHmUgrm4/+B08VKhS/p0yaqDsdyUtqiXz5WKG jh/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kd21-20020a056214401500b00623821414cesi3309510qvb.284.2023.06.09.23.59.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Jun 2023 23:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7sYm-0002uz-BU; Sat, 10 Jun 2023 02:58: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 1q7sYi-0002qh-Ew; Sat, 10 Jun 2023 02:58:48 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7sYg-00063Y-Qf; Sat, 10 Jun 2023 02:58:48 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id BEDACBE2D; Sat, 10 Jun 2023 09:58:01 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 57995B29A; Sat, 10 Jun 2023 09:58:01 +0300 (MSK) Received: (nullmailer pid 1107532 invoked by uid 1000); Sat, 10 Jun 2023 06:57:58 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-trivial@nongnu.org, Michael Tokarev Subject: [PULL 13/16] linux-user: Return EINVAL for getgroups() with negative gidsetsize Date: Sat, 10 Jun 2023 09:57:51 +0300 Message-Id: <8fbf89a9669520ac09b3ae0013ff3eb34f8cab23.1686379708.git.mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Coverity doesn't like the way we might end up calling getgroups() with a NULL grouplist pointer. This is fine for the special case of gidsetsize == 0, but we will also do it if the guest passes us a negative gidsetsize. (CID 1512465) Explicitly fail the negative gidsetsize with EINVAL, as the kernel does. This means we definitely only call the libc getgroups() with valid parameters. It also brings the getgroups() code in to line with the setgroups() code. Possibly Coverity may still complain about getgroups(0, NULL), but that would be a false positive. Signed-off-by: Peter Maydell Reviewed-by: Michael Tokarev Signed-off-by: Michael Tokarev --- linux-user/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 94256cc262..f2cb101d83 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -11676,7 +11676,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, g_autofree gid_t *grouplist = NULL; int i; - if (gidsetsize > NGROUPS_MAX) { + if (gidsetsize > NGROUPS_MAX || gidsetsize < 0) { return -TARGET_EINVAL; } if (gidsetsize > 0) { @@ -12012,7 +12012,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1, g_autofree gid_t *grouplist = NULL; int i; - if (gidsetsize > NGROUPS_MAX) { + if (gidsetsize > NGROUPS_MAX || gidsetsize < 0) { return -TARGET_EINVAL; } if (gidsetsize > 0) {