From patchwork Mon Apr 8 09:52:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 786898 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp1257661wrw; Mon, 8 Apr 2024 02:52:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/ULN42igSKNY5uhWFEXbkiOOUQHFW4lvvi81iTfLVkZyzrcoWlV0tQougfahx0yYW8H3xon9Zr+v+SlUn8L6I X-Google-Smtp-Source: AGHT+IE/8a4/6eDNRdV7tKdu8/dQ7JkrD3n0NR01xJ4UL/ERL5GyZN9wnAJbpnu9Oj2EJeN6ZaAI X-Received: by 2002:a05:622a:1816:b0:434:a317:2df4 with SMTP id t22-20020a05622a181600b00434a3172df4mr2168025qtc.25.1712569958917; Mon, 08 Apr 2024 02:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712569958; cv=none; d=google.com; s=arc-20160816; b=aGhgnc1jd0b6cSvAWGNKDR+2/kFEsMZsTMCbPIPWMCJhtmGF/OGVUNXV6DjTJbLNSW aONk2+ndP62vkM1XWSlE7QWlq4nk2GqeBmkhA5JZMvdtGh+gb3D+ZnLZ/DwYbIdSm379 uruVrWG4sK/az2ro4HHkDx7YZDtrAxEJ45zgZRddQ6Yse5dUypg0FiK7t+zcR4zItLMv R9+952MLgeVZFDCJeh/1Hd6NzDa49qC5JjkSBmTkF8il3395BzPjqfUE5UsUwBzOauYe ZXfz0bfI9uSB3EdXtmkAYJlChNM8ONV3ipBESNcQa4FjcAFfM+FDbOqdnOSvuuFHXia7 uJ3A== 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:dkim-signature; bh=R4JOGeyk5Il5mqTCfLsLzu8RX0JVQXq+A+QA9fciUu0=; fh=SN43CuYikT/v8i344rnfXJvt58ljTvEIa3I/MUOJ87g=; b=UPhqM7SjNvW0XJlu8udZ5Se73wfphZ+9Hkzk2wczTjKYK3mdBQOc9onOLn/1UG1DNw kS65jeqts2jjivYTCvvDWBIYk3LtHmsNZlF9cTfHpFB+dbOKfIS4fSkkaZY1MTdgzsZ6 5EN8II0JJvZeIcjwURb++eDTAPp1LwU1s5XzaZPmcz/Ve7hVn/KfibXoSreYqqzHk0yU LBjz4JBLIZ6djDAsnhlFJ7gaKSZiUCxPzQyIkdiU901QAeh2iByJAhrQVHp8ps7AURVe EzQA9F/s4xxxAiAm87r3uMgrq6ycNHzxvMaJb+WMFOk2D0JsQDTFjbvfEFi7xxP1l7Bg ZFfw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TM528455; 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: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q12-20020a05622a030c00b0043461113b57si7397277qtw.248.2024.04.08.02.52.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 02:52:38 -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=TM528455; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtlfz-0004Rt-HQ; Mon, 08 Apr 2024 05:52:31 -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 1rtlfx-0004QZ-I4 for qemu-devel@nongnu.org; Mon, 08 Apr 2024 05:52:29 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtlfw-0006MB-2x for qemu-devel@nongnu.org; Mon, 08 Apr 2024 05:52:29 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a4644bde1d4so592263766b.3 for ; Mon, 08 Apr 2024 02:52:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712569945; x=1713174745; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R4JOGeyk5Il5mqTCfLsLzu8RX0JVQXq+A+QA9fciUu0=; b=TM52845524jWjlnRBakbvN0Hn9ZKgWByVTXME3aFau1ijlitIZsJ8qTFGGlf+zlAe9 HNPYaaiqnxPz7OrTyCwouxXabidz0uSjh+zrIMUgpOTG9WOHv+8Q3BXW5hYnXN4lcxWW OOEUA+eCYcSMFZSVbcMA/qY6R38X99TskbYpm04izBbNf8cAorIUvPta3ox9aOYZxqrI 4KgC9AVsrl/Vu9NsrWwiGI6hit/zAwYKAYq49uT3i7r3jsKepmObwfHwLQKDYpxcSkoy GqRnfCz5rSfw1jVvrDn+64f0brgV0CSKIlIka+acYqvFJsNjM3n9NNn69odrt6xNzH0z ev4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712569945; x=1713174745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R4JOGeyk5Il5mqTCfLsLzu8RX0JVQXq+A+QA9fciUu0=; b=UPz8cB0QBj9vaWaUhO9rIk+H8nTkAzka+OfK3oO5/XUDhWOMvzVAdeBlJ6xVjM3hkW t6Ad83CYMj5Tr5Y/aedJXI5e9LTTJwylW1rk2wjJ6zt81M4IvNpkBOpv54PQOEHe5kuD UZJEr7tH4T+7UnPXNM/RQCjj7UHMvCi63SoSXIxk3HBybD9izYklBILVsrho+Gtcdt+F GH4/ihzPNKRFewhZVGIL5QKjbLtp19Z9rApCeohREqNafoFNwtqMdTiiALv7RKkdWlR4 +pEjN5bO6xqaqXIoUq8XRfBiYusPa0MsHL25ioh1g1FblKItnc9Fak97iWGMsu1+RwFW /yoA== X-Gm-Message-State: AOJu0YxCxFFRMPf7m41CYnTeKdE2Qa4yoc0gl+4LY3j9sh4gRlOtyAGk 1B8HWevoWGIAhTKou7Il3Skq65Quua1EQ7WjeL4QydWI+9He2CWcR3VwPm0ptBH6NKu6sbhsJo/ x X-Received: by 2002:a17:906:c109:b0:a51:b36e:61c7 with SMTP id do9-20020a170906c10900b00a51b36e61c7mr5234689ejc.13.1712569945094; Mon, 08 Apr 2024 02:52:25 -0700 (PDT) Received: from m1x-phil.lan ([176.176.144.67]) by smtp.gmail.com with ESMTPSA id y15-20020a170906448f00b00a51d250a1a4sm1479813ejo.80.2024.04.08.02.52.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 08 Apr 2024 02:52:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Zheyu Ma , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0? 1/2] hw/misc/applesmc: Do not call DeviceReset() from DeviceRealize() Date: Mon, 8 Apr 2024 11:52:15 +0200 Message-ID: <20240408095217.57239-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240408095217.57239-1-philmd@linaro.org> References: <20240408095217.57239-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.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 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 QDev core layer always call DeviceReset() after DeviceRealize(), no need to do it manually. Remove the extra call. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/misc/applesmc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c index 72300d0cbc..8e65816da6 100644 --- a/hw/misc/applesmc.c +++ b/hw/misc/applesmc.c @@ -342,7 +342,6 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp) } QLIST_INIT(&s->data_def); - qdev_applesmc_isa_reset(dev); } static Property applesmc_isa_properties[] = { From patchwork Mon Apr 8 09:52:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 786900 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:1101:b0:343:f27d:c44e with SMTP id z1csp1257847wrw; Mon, 8 Apr 2024 02:53:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUjNBofEFFuuxgigO3Pvq5H0YGffXbLvFeurppRZkl/KSkQ/dQH4U5b9TuS5huaxZXWFf96PsW7A70RhvAy8l3Z X-Google-Smtp-Source: AGHT+IEBprAGVOSayTFKLMEwNkMKp4xRQQW8anZBm4oMrZuU3+wssz6XOKpEW+eVriUJci88sGru X-Received: by 2002:a05:622a:1908:b0:434:b85d:bccc with SMTP id w8-20020a05622a190800b00434b85dbcccmr750010qtc.5.1712570003083; Mon, 08 Apr 2024 02:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712570003; cv=none; d=google.com; s=arc-20160816; b=nAqEY261a7joI2mdJuvD2xICzLQae5GB+vUgpu0gKb55KDF2UexQbJud0b++pnjbUX AbJ64i2yj9g00sJ7wn7gZGXPq2cYA6mqlJCDcHpjYvJeMoOUisss2QhfC2dOes4fpG38 Q5NKZ74GPnRgq7V1bqflr/GKyRRvSxPcmTPqDVc+WNXIgZafxu/9KpJlHEsyxKf7SZpw 3SUldcluGhf8DKoF7NTQ32VnQRbu6GIopg5bOK7w1DALdtNjRMEDXey1URAgX41t1Q5K +0dKEbkEnc7pf9Ju3X7fxj3swsrc1t77linRBQJlXYZxWhYNncp6sF7b/b9jMElSAqLg nSXQ== 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:dkim-signature; bh=SX5xakbdEor+CW8HJ6tUewkIqcSRy/qmJlj1fBtPDng=; fh=SN43CuYikT/v8i344rnfXJvt58ljTvEIa3I/MUOJ87g=; b=lS1wFu4xq5oa8nK+IO3MS0a7yv1vTlA1GSHvK6HFj30JaPi2VKXocSe7GIsrIXhqpH jtBVs45Rz/Z0Gxi09xxoCaHwgx1emyRLfOofZE2PobLr4ifm0TcQmYv+a15AqCQ52qgn mI9AI5etHXKDFwIto72Ku7oSJvpCj/nqzdAl+H3CjAHqIr3D4DBmroR75+munRYFjNTi WFMVFruaCxmflSn+q0XGWk4wqMtE/T77JfDEG4Dc6EFokFRNCo7NOMY9Guk6ZTiNOFwP XddsvdtP/AQEAmD7i3mDbHdxDExdzANtii65xnBi9HI9klajVvEd5ODJfY0gGpHdgzDP y8Bw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aJfW2gG5; 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: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d12-20020ac85acc000000b004313c5fadd1si7905306qtd.33.2024.04.08.02.53.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2024 02:53:23 -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=aJfW2gG5; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtlgA-0004cu-JP; Mon, 08 Apr 2024 05:52: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 1rtlg3-0004Uw-Mo for qemu-devel@nongnu.org; Mon, 08 Apr 2024 05:52:36 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rtlg0-0006MX-J6 for qemu-devel@nongnu.org; Mon, 08 Apr 2024 05:52:34 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-56e47843cc7so1237815a12.0 for ; Mon, 08 Apr 2024 02:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712569950; x=1713174750; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SX5xakbdEor+CW8HJ6tUewkIqcSRy/qmJlj1fBtPDng=; b=aJfW2gG5FbdRsMCASpI0isTwKKbSIUr1bRkAbYbTkQIDM826KzZ90wh2zd50kHQPif oj6NWIqltICwqdVwMhtOC6UPSNgWNnddvcDp4+WkkJKhL8Tx/sJvMr9cEXdEfFMZRlGC u58JkyC/d4Ma/ijLmfjBqmcNl6CLfAY4L+ahfbqQGDqQNGjW1uUEleDi5LmqHq2X8klh +1Qf63zYZUtbV9ivWAbKVdln8mj/uspX+Wtj0lIDfVtTPLt2yaYTm1mtJKy8BayPoZaV WFNrFkyRubc/mopUKTlbTfqvAm7tv8IokgXBTWNU7vdPfKwvbFve/aZ8UsfxGFX0TQMm I/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712569950; x=1713174750; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SX5xakbdEor+CW8HJ6tUewkIqcSRy/qmJlj1fBtPDng=; b=s1M28E3VbLYWbaUgL6bJykBAYjRHZYYYM307Ih96uEePVzsnSm6ChtLow0kPs/ShG8 Zwi/+AxhNr0SvkSwOAW7FxXR6bMxX4DuIEg2Nttt++UhDLHGB2I7JkImlUFwsAmVRcY2 sx5LMh9gxnxiD3nS9nRMVB4cq7KNTq6aumHQ6Tjj1bYkXjfybo78PSF/bAA2UaORYqBX 79cNWI4Vf6drrgzxsRwsW5BKdK6pN1RBIAmLcq8x/exGEkdyNSkOulI8o94YORGV47JU gRKEi9D8HV/z3QtV6f4JTNwJXRwoBjlKNFLZwTEoT9zRc+uP883uZZXVzfZFFl0zcvD8 S21A== X-Gm-Message-State: AOJu0YwbqekxePbWUWryhe+GSqmGTZxSXceybBeUfWvY3VXGUgmrzsEa uN20FBDkNjypjj+D2RsTI5GX169FcQEHebDg5zL2zYP1a+e6OzkxnIA+jwNxi4fIggngliM9uqc 4 X-Received: by 2002:a17:907:7ea4:b0:a51:c975:f02a with SMTP id qb36-20020a1709077ea400b00a51c975f02amr2584452ejc.65.1712569950602; Mon, 08 Apr 2024 02:52:30 -0700 (PDT) Received: from m1x-phil.lan ([176.176.144.67]) by smtp.gmail.com with ESMTPSA id ck20-20020a170906c45400b00a4e23400982sm4250084ejb.95.2024.04.08.02.52.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 08 Apr 2024 02:52:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Graf , Zheyu Ma , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0? 2/2] hw/misc/applesmc: Fix memory leak in reset() handler Date: Mon, 8 Apr 2024 11:52:16 +0200 Message-ID: <20240408095217.57239-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240408095217.57239-1-philmd@linaro.org> References: <20240408095217.57239-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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 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 AppleSMCData is allocated with g_new0() in applesmc_add_key(): release it with g_free(). Leaked since commit 1ddda5cd36 ("AppleSMC device emulation"). Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2272 Reported-by: Zheyu Ma Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell --- hw/misc/applesmc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c index 8e65816da6..14e3ef667d 100644 --- a/hw/misc/applesmc.c +++ b/hw/misc/applesmc.c @@ -274,6 +274,7 @@ static void qdev_applesmc_isa_reset(DeviceState *dev) /* Remove existing entries */ QLIST_FOREACH_SAFE(d, &s->data_def, node, next) { QLIST_REMOVE(d, node); + g_free(d); } s->status = 0x00; s->status_1e = 0x00;