From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE5A6612F for ; Mon, 3 Apr 2023 14:21:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66411C433D2; Mon, 3 Apr 2023 14:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680531677; bh=E4vPFq6KkOIXDrVd9H3/XXddQaNibLZsPHe/eNEX/cU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KSxCDCYMeMJeTMuFTkleX5juWJI0dDE1v9VQdmuuuNott1nKNn9H9AxFJ4Ayoa1mR qYbc5LdbxXlBNs0hiMOjxzlAzoH+ni6ld3sFfgQnXcRGa2zoTl4+xpxvLlzq9xGnqt +6tATV3kqujkTOt2JRTimHZYM1Yoye1SPuQ3+zto= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Wei Chen , Helge Deller , Sasha Levin Subject: [PATCH 5.4 070/104] fbdev: au1200fb: Fix potential divide by zero Date: Mon, 3 Apr 2023 16:09:02 +0200 Message-Id: <20230403140406.925760406@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403140403.549815164@linuxfoundation.org> References: <20230403140403.549815164@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Wei Chen [ Upstream commit 44a3b36b42acfc433aaaf526191dd12fbb919fdb ] var->pixclock can be assigned to zero by user. Without proper check, divide by zero would occur when invoking macro PICOS2KHZ in au1200fb_fb_check_var. Error out if var->pixclock is zero. Signed-off-by: Wei Chen Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/au1200fb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index 265d3b45efd0c..43a4dddaafd52 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1040,6 +1040,9 @@ static int au1200fb_fb_check_var(struct fb_var_screeninfo *var, u32 pixclock; int screen_size, plane; + if (!var->pixclock) + return -EINVAL; + plane = fbdev->plane; /* Make sure that the mode respect all LCD controller and -- 2.39.2