From nobody Mon Feb 9 08:57:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1628853988; cv=none; d=zohomail.com; s=zohoarc; b=i1Cbj+W6qwjE2XsYDs1E9aYXp7Mw+Vm1ViFoTPfrZJ2BuKt2Rnknf1sCOoGgfZgRBuBGwR3/t3XvjYatWWbBHG6Se1CicXsmfLesyCZ/Q8wdSoH278CTRwmKQ8UJQmB5D6N+be7MFT9IEvwhpwm45Vqlw1cV00Y1Ttnuu6/yldg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628853988; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=wfQAzrKxjRuJBWe/tqbh1NmyCNL6bF3yTkYktgk4knk=; b=K6bynJ9GiBHUriiINKUpsSKqOxSthyrKmwq8b6b+8dccOFbcUFFhibQxA8djVjBUgvOI6IZ6EUTIgl/4lQR890hB8Q863Jz1KZDL+5Oj/b5udf0Yfr1uFIaT+dQgP5hUW7Me2bt/AbqkCi+G7ZkU2jHo58/ZjWDjuodTu0KaLew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1628853987951918.3759492031623; Fri, 13 Aug 2021 04:26:27 -0700 (PDT) Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-HdMdXQ5mPTuu3QiBlsGGiA-1; Fri, 13 Aug 2021 07:26:25 -0400 Received: by mail-wm1-f71.google.com with SMTP id w25-20020a1cf6190000b0290252505ddd56so2598376wmc.3 for ; Fri, 13 Aug 2021 04:26:25 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.. (163.red-83-52-55.dynamicip.rima-tde.net. [83.52.55.163]) by smtp.gmail.com with ESMTPSA id q75sm1254983wme.40.2021.08.13.04.26.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 04:26:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628853986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wfQAzrKxjRuJBWe/tqbh1NmyCNL6bF3yTkYktgk4knk=; b=cbgm7L69zPIQVq+fP/+WVQFCi/u1d9zR4gWMgY8PIv7BuhX8HZVXecOo89y7Og+elBYpuD gRXh/xtiMspahwqTPNv1fokQGn77FCbx6PepK3jdoFHMdA65BRo6I1gPLJSBuLr09HKNt6 M4MuT3jNDsPuO7piTondsLgjG05JXWY= X-MC-Unique: HdMdXQ5mPTuu3QiBlsGGiA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wfQAzrKxjRuJBWe/tqbh1NmyCNL6bF3yTkYktgk4knk=; b=V+hUZBuXwlVJ8bH3goyXEFr+/3lrUJ6FpTwYSgGgWzYprUYolkPb8Tid8JROxrIZAG HaVYyBhNSLXJpFxhIlEEB53hDMzkc8sibbNbFHoyFpMNzjDy/130SLdTt4wrRYU5fbPB C0hQYvoUqmDsGnONOvHZe5FumsJuix8mk/dIJPTxauMDzsBgX4FHi84azMFpb7AmvBK5 KA+oyurVaeHA+hXVIsJ+hbWS5avjm3EN55cMjz9rLHw9ht7L/GERB6MUyPoFtcY0oj1I m5yjmQ2LU3GfovgxYYcN85vtjMXUBJYwCUwvRrQaVGU0ul7picn9Q32Hf3XDPsiR8eoh fFmA== X-Gm-Message-State: AOAM532FQElypI7pGGJtUJQfSJGl1fnf3FyUce02FgvYC//XVCPjDLyf Hoppkpkg1Qwrt3jGHJOuOplgtUAXIfheOABOHiITES/G5fH1lhG1ojQNeFA+TnW8uzMQjyvDleE GS21DJU8AIKX4uA== X-Received: by 2002:adf:cd04:: with SMTP id w4mr1976922wrm.119.1628853984406; Fri, 13 Aug 2021 04:26:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAFnQOwbTdw+3Y1TWppFVvARxX7xWxjwZWDH3bVaNn30JkwTxQIhgOdnlCFeCruw/Q/2Df6Q== X-Received: by 2002:adf:cd04:: with SMTP id w4mr1976908wrm.119.1628853984270; Fri, 13 Aug 2021 04:26:24 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Marcel Apfelbaum , Eduardo Habkost , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-6.1? v2 3/3] hw/core: fix error checkig in smp_parse Date: Fri, 13 Aug 2021 13:26:08 +0200 Message-Id: <20210813112608.1452541-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210813112608.1452541-1-philmd@redhat.com> References: <20210813112608.1452541-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1628853989311100001 From: Daniel P. Berrang=C3=A9 The machine_set_smp() mistakenly checks 'errp' not '*errp', and so thinks there is an error every single time it runs. This causes it to jump to the end of the method, skipping the max CPUs checks. The caller meanwhile sees no error and so carries on execution. The result of all this is: $ qemu-system-x86_64 -smp -1 qemu-system-x86_64: GLib: ../glib/gmem.c:142: failed to allocate 481036337= 048 bytes instead of $ qemu-system-x86_64 -smp -1 qemu-system-x86_64: Invalid SMP CPUs -1. The max CPUs supported by machine= 'pc-i440fx-6.1' is 255 This is a regression from commit fe68090e8fbd6e831aaf3fc3bb0459c5cccf14cf Author: Paolo Bonzini Date: Thu May 13 09:03:48 2021 -0400 machine: add smp compound property Closes: https://gitlab.com/qemu-project/qemu/-/issues/524 Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20210812175353.4128471-1-berrange@redhat.com> [PMD: Check MachineClass::smp_parse() returned value] Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/machine.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 159c6b098e2..29edf655140 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -834,8 +834,7 @@ static void machine_set_smp(Object *obj, Visitor *v, co= nst char *name, return; } =20 - mc->smp_parse(ms, config, errp); - if (errp) { + if (mc->smp_parse(ms, config, errp)) { goto out_free; } =20 --=20 2.31.1