Message ID | 20220719134853.327059-1-peter.maydell@linaro.org |
---|---|
State | Accepted |
Commit | d12dd9c7ee0ecab96efc21a263772fef2fff3ac6 |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5817:0:0:0:0 with SMTP id j23csp3984026max; Tue, 19 Jul 2022 06:53:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tSddQQ0KmJ3gNSaQRWj0szdaHkvQcKHfofTvaYuqVIsQQUFGeSv/oSZ/43FzdhbgCsmBel X-Received: by 2002:a05:622a:1ba5:b0:317:c65b:3ad1 with SMTP id bp37-20020a05622a1ba500b00317c65b3ad1mr24639614qtb.117.1658238833969; Tue, 19 Jul 2022 06:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658238833; cv=none; d=google.com; s=arc-20160816; b=TpZIoQz3hwprlclZNgkMThLcj+tKihnq4E6Lie4PysJqol/UwjaD3XWO2OwI6htb3U WWydR/O8yhk3CfkPdBQfiUD5Nwr8JS93PaKkzsJ0Cefacf3Fb9kQNF3Vvx2n1ZBs1LlT r6z/iI8WloWfafcF0zsyzq3mHydawuF11o96XUwDjuUzeyBQv8VJXnz8sQsR94vznQxj UBX56ZY9ncU5Jszujpjcg1OmP/HF5GoKWU04ph8BiyiSnJ3kRYzfQfEfykZt2JehXA4o 6CvB+4o+lAlKqyJmjjxH2DDHtQR6Ev3ni6yfm7EKouX2cVngYoVIiJxt8a6rCr23hTN5 izGw== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=FllSCVLoep8lA6JkfG8iV3FNWrJASTbVenINWIRkquM=; b=dZIDn4iR7++YaiJPY8MC81cqpeYTSpTzB9vjeOfZk7d3txOqvBj/zynlHCpGlbKeTV kpfmcE21A0XLfalFmU0LnvNYVdSyV3hCXw5YATmwXkyieo1FTCzzY13CaTjSv9ubWM+p Vzip00v2pu89VyYnP2/gpod/oRd/tjKwnUttzkVdiam/vapqvS8VonMd6bhs4S/GzsjK lK0DxR6YEBYVhKb+L/2DSwUGNKNbI0HkVXvSABSAhR2NaqPeXbTzLuv/FRLMNza+H9zZ aYw2uwbhDserXQS9JE1sHwuWK4o/53/AWBekv0YhB9bAGgsVdzO0M4KPqldqBnnGtlfl LsJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q4NfbkJK; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x6-20020ac87306000000b0031bc589ad95si6176370qto.628.2022.07.19.06.53.53 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jul 2022 06:53:53 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Q4NfbkJK; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <qemu-devel-bounces+patch=linaro.org@nongnu.org>) id 1oDnfd-0006H7-EI for patch@linaro.org; Tue, 19 Jul 2022 09:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>) id 1oDnav-00008p-Ft for qemu-devel@nongnu.org; Tue, 19 Jul 2022 09:49:01 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:40954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>) id 1oDnar-0001vy-Ng for qemu-devel@nongnu.org; Tue, 19 Jul 2022 09:49:01 -0400 Received: by mail-wr1-x434.google.com with SMTP id z12so21696554wrq.7 for <qemu-devel@nongnu.org>; Tue, 19 Jul 2022 06:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FllSCVLoep8lA6JkfG8iV3FNWrJASTbVenINWIRkquM=; b=Q4NfbkJK/mLbW/OR/F/SPxVZ8DvS+EKCNIJ6PWDvRw2xNhOs/MRchZlaJ5OYo+gDh/ k9inR96U9VtQpQfTtZRyCRKErLV3THCdFsHo7RBVFEuPPXoMgy7MYsz7VJ5agmX3qNAY /+vXR1XxztO/h/uot7LeL7Jvyad1dckxYKq2PlUldE1fYV592Z80gb/NTKHrQR6krsGG AfJ97hdeCHADmwRceAQDINEXL0PNMeML31X1tfEEqKm4BIIfOTHqQraMOAR0cHpZU3kf CYUDJW9IuHV1nF33DzQSHJp7doNpqGlhnc9kaIMro3IEAduoru1P9jimMoPzNl3SACUS fwLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FllSCVLoep8lA6JkfG8iV3FNWrJASTbVenINWIRkquM=; b=Z02cF180SyhIKjSoge2srziml+7GpbP2Ool4vxwX7ZdQsw7BEL+GBJoDO6ivfIwLLU lebyFRWvEeKlBIH8iLawk9WOvBYnJNKevOR8Q3MthYrbTZDKPX1D7sMpklXxS05wiQQc xE1a44sHccsDUUbcBJ6l8Pj77PrF10OZXK5uQgpjI9dxyE5OvsZmgdtvmjYx/2/Vu70G 396hFXDzWd6w1/EnPXJRmD/pgINBmUAjKFoUUcEeavxIdn4m6Q91hWg+lRLcS7uGbTs8 RU5cUxJhXxSgXrhR6MJ5jUyyTdeNUgyHePCskagNzY+jL26KXDg5nWZFxgNS/stjEIN0 prGQ== X-Gm-Message-State: AJIora9tmN8tGfnCSIdekqtphwkgHmwgG8nhLvgBoexG9n2RcsiA+JOy mYHVpnrQuxocI9A638pC99BcdiiPEHHVWw== X-Received: by 2002:a05:6000:184c:b0:21d:beaf:c2d2 with SMTP id c12-20020a056000184c00b0021dbeafc2d2mr24896897wri.562.1658238535803; Tue, 19 Jul 2022 06:48:55 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q5-20020a1c4305000000b003a2d6c623f3sm21942829wma.19.2022.07.19.06.48.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 06:48:55 -0700 (PDT) From: Peter Maydell <peter.maydell@linaro.org> To: qemu-devel@nongnu.org Cc: Paolo Bonzini <pbonzini@redhat.com>, Mark Kanda <mark.kanda@oracle.com> Subject: [PATCH] accel/kvm: Avoid Coverity warning in query_stats() Date: Tue, 19 Jul 2022 14:48:53 +0100 Message-Id: <20220719134853.327059-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patch=linaro.org@nongnu.org> |
Series |
accel/kvm: Avoid Coverity warning in query_stats()
|
expand
|
Queued, thanks. Paolo
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index ed8b6b896ed..eb7fceb3362 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -3980,7 +3980,7 @@ static void query_stats(StatsResultList **result, StatsTarget target, stats_list); break; default: - break; + g_assert_not_reached(); } }
Coverity complains that there is a codepath in the query_stats() function where it can leak the memory pointed to by stats_list. This can only happen if the caller passes something other than STATS_TARGET_VM or STATS_TARGET_VCPU as the 'target', which no callsite does. Enforce this assumption using g_assert_not_reached(), so that if we have a future bug we hit the assert rather than silently leaking memory. Resolves: Coverity CID 1490140 Fixes: cc01a3f4cadd91e6 ("kvm: Support for querying fd-based stats") Signed-off-by: Peter Maydell <peter.maydell@linaro.org> --- accel/kvm/kvm-all.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)