Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98CEFC4332F for ; Sun, 29 Oct 2023 23:01:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EAEDD10E1C7; Sun, 29 Oct 2023 23:01:21 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 09A1110E1C7 for ; Sun, 29 Oct 2023 23:01:20 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6D0FC60B37; Sun, 29 Oct 2023 23:01:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43F73C4163D; Sun, 29 Oct 2023 23:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620479; bh=V3MW3HlJw0Dv/VdEsrQyNiXGgZkXx8rL2UAla9DTeeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e8xdJKbFHIia/kzT6Om75p/55YDyIOEkAu1qJxSveoVeatEvjOpyyJgrYB0OPMcjB oQ64wWxsLiPLeM8AKK+1BbpJdF5IFc2tJFlZrU2aFNSns+bifccc8r4iiabtRUtqLz C9ay7sqb9noHo+W+dWVRJIWgA+B5tEP1ceDZoig/eyGQQY3VeK3EPfixxywRn9ZlWX +XCTeQFE8Vns08tv8SpbRGNeLXimTYsUEd64OpozoY+hhiaUSQ3ku03w20bRWRp+/F /27GuJq7XR+fwHuY+KZLoTiFk4umcOwUz9w9wqnik9FywRG+usJh3WS8YzviGzYcUt zn3ZUIyjhKHuw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 10/13] fbdev: core: syscopyarea: fix sloppy typing Date: Sun, 29 Oct 2023 19:00:43 -0400 Message-ID: <20231029230057.792930-10-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029230057.792930-1-sashal@kernel.org> References: <20231029230057.792930-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.259 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha Levin , linux-fbdev@vger.kernel.org, Sergey Shtylyov , Helge Deller , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sergey Shtylyov [ Upstream commit e8e4a470b677511f9d1ad4f3cef32adc1d9a60ca ] In sys_copyarea(), the local variable bits_per_line is needlessly typed as *unsigned long* -- which is a 32-bit type on the 32-bit arches and a 64-bit type on the 64-bit arches; that variable's value is derived from the __u32 typed fb_fix_screeninfo::line_length field (multiplied by 8u) and a 32-bit *unsigned int* type should still be enough to store the # of bits per line. Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool. Signed-off-by: Sergey Shtylyov Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/core/syscopyarea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/syscopyarea.c b/drivers/video/fbdev/core/syscopyarea.c index c1eda31909682..7b8bd3a2bedc5 100644 --- a/drivers/video/fbdev/core/syscopyarea.c +++ b/drivers/video/fbdev/core/syscopyarea.c @@ -316,7 +316,7 @@ void sys_copyarea(struct fb_info *p, const struct fb_copyarea *area) { u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy; u32 height = area->height, width = area->width; - unsigned long const bits_per_line = p->fix.line_length*8u; + unsigned int const bits_per_line = p->fix.line_length * 8u; unsigned long *base = NULL; int bits = BITS_PER_LONG, bytes = bits >> 3; unsigned dst_idx = 0, src_idx = 0, rev_copy = 0; -- 2.42.0