From nobody Tue Feb 10 09:10:42 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1769650344; cv=none; d=zohomail.com; s=zohoarc; b=oEXXw2vAjVl4CnN0coXtwQsFbx7+0pUb3Y60v2sEk8EULztJhUZ1srq0sAfUSNaW7wLzBSYVGqSDoFPzx5sXjv8ILMfu6FQIB466Ayd/CDiEqMcL3ZjXK6ZX1rpdacuZRfHiHsLVe2+LQXVEZrRiqi9MvBwTvGIBReo6Nw82euI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769650344; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jiteZZFsxsucsTi2GA57zdKipHQ9ataVKeACzlSeVWI=; b=CPJS+nHAThl1g9yeA5r0Hw/eJiahDD6Zud6ncu4h3NK7In9aekGKFAtow3BRubCGiReu5y5s8APwyY8I5D1ufWprozTWFol9f7IcsJWcjddJLRMRMsFh4sx2weoEIxW+npRhvdYSD7YuGAh+uCi0V925E9zRhMY/Yq/V5xRsSSE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1769650344296546.5896274569917; Wed, 28 Jan 2026 17:32:24 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vlGt2-0008R2-Qj; Wed, 28 Jan 2026 20:31:58 -0500 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 1vlGsw-0008PK-Rv for qemu-devel@nongnu.org; Wed, 28 Jan 2026 20:31:50 -0500 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1vlGsv-00037H-BK for qemu-devel@nongnu.org; Wed, 28 Jan 2026 20:31:50 -0500 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-8230c33f477so229552b3a.2 for ; Wed, 28 Jan 2026 17:31:48 -0800 (PST) Received: from pc.taild8403c.ts.net (216-71-219-44.dyn.novuscom.net. [216.71.219.44]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-353f61e0007sm6627143a91.12.2026.01.28.17.31.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 17:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769650308; x=1770255108; 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=jiteZZFsxsucsTi2GA57zdKipHQ9ataVKeACzlSeVWI=; b=zT1c8DyMPz9YMgsNLqzZuwYfcR4sMFxYhSZjGHahpwYxIZr4Wtz6b1/XorqvYpClNY EWvRHtG4m93nG3pPOmKOX68f5quyHDw567k5Q57lyV1w1bj2Od4oxqgCdqB6JEC2FGOB f8u5nuqZ2c2e/h4MPs7AALn80SSt6qDJpi4zUU/pgY6NfNyoPfyWyAmaVTSXZXothSCn xHHqTRr/CbO9XLDggW54GAIB/pBACUDc5+aVEua02s+br1JZwpbBAvdBEyJsQX066UX6 cY2DLhb0uS9L2wAuYnVgzHqqmeRe3sYXOwHJy8IPkI+NRH9Z7htsA/knWQTvrZXK10Y+ I5kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769650308; x=1770255108; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jiteZZFsxsucsTi2GA57zdKipHQ9ataVKeACzlSeVWI=; b=hdHvT8hQ94QO47A9M8yseEbJ7HC6NLBbueNbuwjGJsodN2CRywPVbj1G9fLsXx/ykK i96empbrp3fydNLwASMq7NKI17sWuUOWeSH+cbl/HXy4XerAXjwlxUkYdOTfqkACIJv/ Pv3Ge+wf8c6LGoEHLuwI3qO65ppMQfGhWSu5B3qNWdQFKNs6zJKxp4SQQFK1bThGAJMd SbizZ2KYrA31Q3mfWG0mapIYNmoTJ7j7qkGnhdRvUABywdkFBvFY6hYlFspW0E1gZwQw 8++GxrWoMx9X7LvBUVN3HRxrrgev60hiUMyOaoH83iV7DXmOifE+bJIDuWnVwi+BMtp1 bL5A== X-Gm-Message-State: AOJu0YwfbZuM0WUwDaUSA8RbuCQT11atsxHuYhGIqEAQmP4TfFOL682v TyjDJ9QIcDKN9TtcP+n0drpFQcJGbtuGV1sWATAR+/hsGwoirc6BzQ31pnmQ5JFvCqBqVZ4X/OZ 6vs6X X-Gm-Gg: AZuq6aK48gekj3cTJFgn6tXXJcnZnVMBQs7t8vXfEf+Euin35bJk0GIjZ2+rKAFyW+6 uXB6R/b55HdqVq6JKifpKeDs/U0LgADmwfekN0iKUa1CROepBy1jod1uRHUSGIKmpUaLUXHLLuS +wKqieJAtjTXR1zN3eK5wb3Kh7FdpMjBJziaNuP72C9eautzArlVjNQePOhyV3KPDdZFvSEvjek UOBtRQh5GjQ5S4QztIj6X6QKCIg53bTkrz44tEG7Ar0ZmrX1DxSylbN2jz0sDrq0f1ZvxDIb5Qf I4W9Aj5mkBaKw0UtrwU1OdKR353yqFvfr5eb0IdFThJDqD0rxTGA/B5mAXVwqUoGVtCnT/Z4Nv1 9XR/+zB9nrhgP1XFdWJ0brvbXt+HvVnB2kasFZZqI2q+nf/rT4Ai+vGnIf1FqRi0bvz9T/szYMz QwZMgAihOVO6tW+Fx6NSUSTYMnwbTnS+a8hYoTz2x0tQ6cPKaLGpTd9ihn9m2dR3Wp7BcKQ4KZl 8I= X-Received: by 2002:a05:6a21:648d:b0:38d:efca:1be3 with SMTP id adf61e73a8af0-38ec640a0f0mr6961764637.37.1769650307651; Wed, 28 Jan 2026 17:31:47 -0800 (PST) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Alex Bradbury , Pierrick Bouvier Subject: [PULL 02/20] contrib/plugins/hotblocks: Fix off by one error in iteration of sorted blocks Date: Wed, 28 Jan 2026 17:31:16 -0800 Message-ID: <20260129013134.3956938-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260129013134.3956938-1-pierrick.bouvier@linaro.org> References: <20260129013134.3956938-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x432.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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1769650348487154100 Content-Type: text/plain; charset="utf-8" From: Alex Bradbury The logic to iterate over the hottest blocks will never reach the last item in the list, as it checks `it->next !=3D NULL` before entering the loop. It's hard to trigger this off-by-one error with the default limit=3D20, but it is a bug and is problematic if that default is changed to something larger. Signed-off-by: Alex Bradbury Reviewed-by: Pierrick Bouvier Signed-off-by: Pierrick Bouvier --- contrib/plugins/hotblocks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index d3dd23ed9fa..cf4d6b8c363 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -82,10 +82,9 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) sorted_counts =3D g_list_sort_with_data(counts, cmp_exec_count, NULL); =20 if (sorted_counts) { - it =3D sorted_counts; g_string_append_printf(report, "pc, tcount, icount, ecount\n"); =20 - for (i =3D 0; i < limit && it->next; i++, it =3D it->next) { + for (i =3D 0, it =3D sorted_counts; i < limit && it; i++, it =3D i= t->next) { ExecCount *rec =3D (ExecCount *) it->data; g_string_append_printf( report, "0x%016"PRIx64", %d, %ld, %"PRId64"\n", --=20 2.47.3