From nobody Mon Dec 15 22:43:30 2025 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=1752171892; cv=none; d=zohomail.com; s=zohoarc; b=Z7asbvn+6YuOsInKl9g3byMiATWzcnCBGrcwbLBj2f/XSS9fW0f7mH85pua4HCX+ic5ElTuAo9426wicqKBpI5xo8ci6pxAqw3Bnf3R+FiMXezFbm+zsp2lGZPBtuI7BU1GtTeB5honz2NgxkYbIkchessZGu0NcY3pN0kEJ0Ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1752171892; h=Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=6q4CPzNSFHkl+W3MMlVl+w4aksqgE/U7SNmb7FH1q2I=; b=oCuGBa3Pg51Sni24bKrQCjQ03pPlQUpBM7svelgf7cposABLdlyzIza2DVxwSJPHJI907JoYCARPksCZwLLJ6rlYcJ0yjRuZ6sOxNsTQJjImtaaNB5I1e2ZIuez5cWiNf7IGF7y23EGwOuFdVbPjdH4iA6/TVTmm18PpR9ElGbg= 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 1752171892719482.26676985983977; Thu, 10 Jul 2025 11:24:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uZvvs-0001P1-NA; Thu, 10 Jul 2025 14:23:44 -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 1uZvIj-0000oM-Kj for qemu-devel@nongnu.org; Thu, 10 Jul 2025 13:43:25 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uZvIh-0000CF-Uw for qemu-devel@nongnu.org; Thu, 10 Jul 2025 13:43:17 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3a4fb9c2436so898113f8f.1 for ; Thu, 10 Jul 2025 10:43:15 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b5e8bd1924sm2462541f8f.16.2025.07.10.10.43.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jul 2025 10:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1752169394; x=1752774194; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=6q4CPzNSFHkl+W3MMlVl+w4aksqgE/U7SNmb7FH1q2I=; b=BCpraWfojXPBS0AW+Jilqx8KBYTHh9JUvXoUCsvRZvT00SmPSSPyQnZ64xuHeBnViz gA55nrWNXpL1PZgCN8246ATG3EdbvSY6AzgPtfd4F6jBty9NIOkveF5nEXY2J2nIv1LB DDMyPJjbAoP9FKSKKbgE6phGLHC9c2UlB8k61fnV0gH7Myd0AHjRVyL94cH9ZdNui6PW A6sqsfhj7l/T6n3qDYVmR4FAIfPYSVaLqvGzXBCl7HYUY/y+QweOV1AD4wrow2u6U9yD Uc0JJAW0GhN7a/OSJ2j65PnpG0+3g6xH/1Zw7BQ+lVoZGEVKFBQm+uxYpna0t7DvEesE +GZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752169394; x=1752774194; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6q4CPzNSFHkl+W3MMlVl+w4aksqgE/U7SNmb7FH1q2I=; b=oBKM+lpI+lk9wtW+Upbi6Vnz81y2cTdvYI6NAmlz5ttFgSO6ujD7oiviur5gz+HMcB /VhfULuVSyRSlUmtfuXwNx1pVbJBLkbhw9c+QDohq6nFvqz8JsxUu8CuW0/U/OiwIIS+ YzOB5psSb1rQEY2WB1udBk7THpsqjj4lqOBOGY2F2TTjilZ3goKaY8souT3rITb7lIgR q27lZYER7GGtaRyve+XDIca8OOBxY/JwVZi+qjE9HCFws0llIQFZGH2ihvTDIGnIwSd0 PaCwNt83GXA4Bh8P1Arlf3Fvz6R5cYUipIo+fDn3JI0+0K1Pll4ix/ejYsR7YXdvpcuZ uSUw== X-Gm-Message-State: AOJu0YzVozjaiFujNnTI11udKGjSDD3NwsM0UzVqrU+0BTI6SCeUUCVo 9D82FaRaeYKHK2PJeYKcYulf43sZW7J3b7Q3r57cRdrxBiTDzfmYgClr/IJq04lTD0V3EPLfe71 f9gf5 X-Gm-Gg: ASbGnct/1oUj5bI/3o9cvSetCxT6cfdUKMeAYgVUS8sLGeykGT5Nar/Liu6P0s0bQ+b 4KEhh/DQsEKVYR87Mi/YSh2hX0L3E9REUUzhYLPFQrkNh0yLh4Bs/9mZ7rbwb7rdMF7H8iToEXK uTyvXfF9SItPtI2F1WPeprr8lUhmSFVOe3UnGiAstTvIb5IauG0HUzxpWHXAJGflk6FsNcnlf9f ASAUxDisxm5deauoTFspUErZx5Nw8EpE/Cemor6UyhJJ1ZgH72ihApryJ6PMYuafe7LSqaDfu8p T7yI7PfAUtgQ6rd3XJ5BkUy0nXs0GPhNuOqE9rUckwoyFxaXp6BrDdx4vhHf+D/hS1kU X-Google-Smtp-Source: AGHT+IFtl4IKDY7MuYQYNSgDBslWzZxGPAvfiXiQP784ocNiNftXe0k4ZbTTg2zWG/pp+86ChW7sbQ== X-Received: by 2002:adf:f089:0:b0:3a5:39be:c926 with SMTP id ffacd0b85a97d-3b5f18cec74mr348870f8f.32.1752169394198; Thu, 10 Jul 2025 10:43:14 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH] hw/display/framebuffer: Add cast to force 64x64 multiply Date: Thu, 10 Jul 2025 18:43:12 +0100 Message-ID: <20250710174312.1313177-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 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=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1752171895099116600 Content-Type: text/plain; charset="utf-8" In framebuffer_update_display(), Coverity complains because we multiply two values of type 'int' (which will be done as a 32x32 multiply and so in theory might overflow) and then add the result to a ram_addr_t, which can be 64 bits. 4GB framebuffers are not plausible anyway, but keep Coverity happy by adding casts which force these multiplies to be done as 64x64. Coverity: CID 1487248 Signed-off-by: Peter Maydell Reviewed-by: Manos Pitsidianakis --- This is one of those ones where I'm on the fence about sticking in the cast vs just marking it a false-positive. --- hw/display/framebuffer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/display/framebuffer.c b/hw/display/framebuffer.c index 4485aa335bb..b4296e8a33e 100644 --- a/hw/display/framebuffer.c +++ b/hw/display/framebuffer.c @@ -95,9 +95,9 @@ void framebuffer_update_display( } first =3D -1; =20 - addr +=3D i * src_width; - src +=3D i * src_width; - dest +=3D i * dest_row_pitch; + addr +=3D (uint64_t)i * src_width; + src +=3D (uint64_t)i * src_width; + dest +=3D (uint64_t)i * dest_row_pitch; =20 snap =3D memory_region_snapshot_and_clear_dirty(mem, addr, src_width *= rows, DIRTY_MEMORY_VGA); --=20 2.43.0