From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AF58C4167B for ; Sun, 29 Oct 2023 23:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232151AbjJ2XIa (ORCPT ); Sun, 29 Oct 2023 19:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232089AbjJ2XH7 (ORCPT ); Sun, 29 Oct 2023 19:07:59 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01FB7A5D1; Sun, 29 Oct 2023 16:03:24 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 575C7C433BB; Sun, 29 Oct 2023 23:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620516; bh=V3MW3HlJw0Dv/VdEsrQyNiXGgZkXx8rL2UAla9DTeeg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TqokyoJEOy4FBHdvp1nprVYYUkHfvGgCemykOTcUGd6iF0sKEMMX3dFf1riy53aFx DYkCn4G53LkN5POXNALoAe3RiT8AW3fL2mNS9A7T2Zvz8jS2ioYMH0dXM9dw+exQPW FmZjkEYMs9uYV9DMeOdyBCXzmPiLsc0wtTy48flmh6G2m6r/JUopx6w69XRdxBApLA HKFjOwrcM/ZM2NT84/4bAlQ0eoy0+xGwnCMDL5Xabn4o4xVGn9dzAGMqNm78IQlxI9 6LanPWmn8jPV98S79xZHNGt/bfbnfs6X5AUQszzzbp9Tao/gffH75pHd+MbMwmsJwv i7FuSxZGeEo0A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sergey Shtylyov , Helge Deller , Sasha Levin , daniel@ffwll.ch, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.19 09/12] fbdev: core: syscopyarea: fix sloppy typing Date: Sun, 29 Oct 2023 19:01:22 -0400 Message-ID: <20231029230135.793281-9-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029230135.793281-1-sashal@kernel.org> References: <20231029230135.793281-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 4.19.297 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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