From patchwork Tue Nov 19 14:23:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 844270 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp1181455wrx; Tue, 19 Nov 2024 06:25:02 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUk93E51iG9i5iY9hsBR1gD/6VMRRHx1mJLvP8Vk2GWFeKxhQXcqVfstF8i0RuSCqs4Vjq3Gg==@linaro.org X-Google-Smtp-Source: AGHT+IH0XaYauBk0USsKhDkaVxw7Zq8Du8EyxjDtorVHdDrA5zNNnjP5TsQDDRibRVOoeJ2E1YDH X-Received: by 2002:ac8:5811:0:b0:461:1c54:5bd5 with SMTP id d75a77b69052e-46363de8ec7mr219003071cf.9.1732026302271; Tue, 19 Nov 2024 06:25:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732026302; cv=none; d=google.com; s=arc-20240605; b=XdMQPQXnA90sJR5T3torAcRB+xQjHNSqaINQaKAD8EnsZuS7KdZJCNEfnJorTf0fgt S8UF4DavMVWpAPaITcPUXWJ2VAeh5sv/fiyUqI9H8N1lqe32tUEutjrblpjxJlGtsxdW 0FJanK86zKUZigXHl8S0VYk7onY2EMRK9LKTaZIdMvfCqXhlNkSeqASeoZpMAuudpJzv U0RlQZPLmtLpowTFcEW+VHOPnQcVChF+m9FCv31nYyTA2IzVmun2IRerCCMfB1kCi088 g/Pfn7HPSrHKtmBP5F0hxW0/XtQfpstLqqq+hTree2ePJBagqUW28kb6mr0yCa55FW/7 YpXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:to:from :dkim-signature; bh=Uf4u1FQII+EcRWfJ9x1uUFpYR7e3NkroR87Xx7eXM1M=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=iZwyIturoEHi6IXtsExqAneOCjfDBRWtBS+tFPF2jkTDClmWhQrasRPqqDBIMI5WUm G1R5RbFzfaWybFwHCIdZCJVa0853NCzwbbMzApS33rYjtICPT1Q7GXS26XBWD9LQ6dQ9 G0ewfmrO66T6dCWOULuSpv7SlYSVnA99I8P+c1+wmBhsywP0DAJI8j5q7c9uG/AUvVdq IkWHxurqMK5BVbuZLmKYVwT+4phuwo9zYL7eQe3bOhJL/izcMWSMDfhFDL+SnoDXuOxG fK7ARq04qkXEL5cg03NynvfX01R30zNnSWfV3QFoX5KrMrPimAtotbHmMewM76ZxDj+U pkAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="amB41AV/"; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46392bafd41si25541411cf.192.2024.11.19.06.25.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2024 06:25:02 -0800 (PST) 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="amB41AV/"; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDP8b-0005q6-6n; Tue, 19 Nov 2024 09:23:29 -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 1tDP8Z-0005pK-FK for qemu-devel@nongnu.org; Tue, 19 Nov 2024 09:23:27 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tDP8X-0006CB-9T for qemu-devel@nongnu.org; Tue, 19 Nov 2024 09:23:27 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43167ff0f91so39259445e9.1 for ; Tue, 19 Nov 2024 06:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732026203; x=1732631003; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Uf4u1FQII+EcRWfJ9x1uUFpYR7e3NkroR87Xx7eXM1M=; b=amB41AV/u2T3TP4oyevnnMvuWWdsKBJLndE01rvlDvpciPLw/vEwMeXG1QHXYEGbtC FvW7Eufw1xTkTz7xeh2/34YWWJbU+j+nRfeiLC40x/DrZM1c4Qk3e3vHZj5v6HBxXjlt qZF/PTDQvWD5dabnshNFLRNssjCuFeN5ekCTUYDsDINDFt1hywjhIOXvsu4yGXRsXyHU sXeKgMKhS/YGkcX8noVl/WgRKGmE8tXQyHZKMedamvRVZRUpM9Go95znuNqBqwXhqkj6 YHUyVgmx4dMdtTDcGKW4aun+519N2x8fcIaQBT7N9RSyzAvy5TsJe2q7ny6End1uHZUD CqAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732026203; x=1732631003; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Uf4u1FQII+EcRWfJ9x1uUFpYR7e3NkroR87Xx7eXM1M=; b=bRNtluvcHV5DB7pJMlkn7CTgynJjy0KWezsMaHJ5bM5WElrDYfio2INuBTOAKuK2ZU QaaPCNlOWiPC+1sCylzOSeXH3zM6dR75MQIGt6AZtd+vqF5pIefZaEVhirJcxlwTvhm9 4Lp9JA48PcQgTmLYknBTbczLodmcy+XoV6s9qSd6/eKqnmd9RZQJEjqLWnYobNgCTmOI oMydEF8mkc7ZFVR0EwJGOz4p5DKEevv693DxsZFHZSQMm4GlT5+ZXqoF6gqhCLADcgmC 75cdO7Sod0NIXEKFGJqmkQorSLZQ/+rg1dkncx7XXcBYdMW/zyZpqb5FoAXEUiqRK+fR yjJQ== X-Gm-Message-State: AOJu0YwFUqHG5RqAHPq1RLQnST0glA1oPnoeSjiBPpVm685a6rQcYiaH HsBc5gx4MdMDNq/m35LNsQfsWK2p0niUclUvxzUTeFMudr8p5groS1AU5V9ZFB49GHBiRoQVSMO M X-Received: by 2002:a5d:59a6:0:b0:382:503f:a323 with SMTP id ffacd0b85a97d-382503fa505mr1478473f8f.19.1732026203335; Tue, 19 Nov 2024 06:23:23 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432dac21a15sm193049985e9.38.2024.11.19.06.23.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2024 06:23:23 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 01/15] hw/timer/exynos4210_mct: fix possible int overflow Date: Tue, 19 Nov 2024 14:23:07 +0000 Message-Id: <20241119142321.1853732-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119142321.1853732-1-peter.maydell@linaro.org> References: <20241119142321.1853732-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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 From: Dmitry Frolov The product "icnto * s->tcntb" may overflow uint32_t. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Frolov Message-id: 20241106083801.219578-2-frolov@swemel.ru Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/timer/exynos4210_mct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index e807fe2de90..5c6e139b202 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -815,7 +815,7 @@ static uint32_t exynos4210_ltick_cnt_get_cnto(struct tick_timer *s) /* Both are counting */ icnto = remain / s->tcntb; if (icnto) { - tcnto = remain % (icnto * s->tcntb); + tcnto = remain % ((uint64_t)icnto * s->tcntb); } else { tcnto = remain % s->tcntb; }