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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0A7DEC05027 for ; Wed, 1 Feb 2023 13:10:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RzI+RgB1GZqvvHU7xOVIiktYYft2N+MXqGorVgB2zEc=; b=jDC+ckbe5Djb3U LozvWXpAmpvYAqXoZvCErwpuFMhWiImC0Wwo+vXmKYsucXKHyjyVTS+h8w14EaynPie3eDhpOuG+j rQj7Fy2L4o5Cp0W/5WuYUNuY+uch00joOZ1Ews7Y2ploZAmInFTqdNIZCUPIowtxYKk0uGFWtL3Ei dbrKCN8/cxU47yi4RTqKPOCzg4QQf3mD3+7jLrgcOfoY3PfNvoIcdkmyhJAq83g9ByI4xOlI11O/X A821CtTZhFH3OWSzCMNuX1cSBCHYH73ZBwyqqy3g5J3qTYBi+jX0H6hQ78Anf57YCcsQ96UqYXUX0 GfmJahZz7/0kbg1JqSeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNCrP-00By8y-0W; Wed, 01 Feb 2023 13:09:11 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNCos-00BvKB-0Q for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 13:06:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C36261795; Wed, 1 Feb 2023 13:06:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 988ACC433EF; Wed, 1 Feb 2023 13:06:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675256793; bh=GnaimmLKefZRjOPzvWP+ABUMPmzcZWg/oE0SlaIO8qA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=U9/871CFxrDT7QczJzo8MWNftedHmkpmn9hia5EiH2mxDCNB3+gr09zIaIRQJ0BUN u7Lu5mSTWnwIf0zrI6oeo44lRLY/2XkPNdxp2cEeHVyYAKv6kS7bcv5n3sXsDGYecT tJ5whSOP+pagxiKa9ZGxU7HLzk1SqAyp8lUiqYNI= Date: Wed, 1 Feb 2023 14:06:29 +0100 From: Greg Kroah-Hartman To: "Alexey V. Vissarionov" Cc: Krzysztof Kozlowski , Alim Akhtar , Jiri Slaby , Thomas Abraham , Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-serial@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH v2] serial: samsung: fix buffer size for clk_name Message-ID: References: <20230116141658.GC8107@altlinux.org> <20230201024457.GD446@altlinux.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230201024457.GD446@altlinux.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230201_050634_130371_000C5F70 X-CRM114-Status: GOOD ( 22.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 01, 2023 at 05:44:57AM +0300, Alexey V. Vissarionov wrote: > serial: samsung: fix buffer size for clk_name > > Although very unlikely, the 'clk_num' value may be as big as > 2**32 - 1 (uint32_max), so the buffer should have enough > space for storing "clk_uart_baud4294967295\0". > Also, the numbers in clk_name are expected to be unsigned. > > Found by ALT Linux Team (altlinux.org) and Linux Verification > Center (linuxtesting.org) using SVACE. > > Signed-off-by: Alexey V. Vissarionov > Fixes: 5f5a7a5578c5 ("serial: samsung: switch to clkdev based clock lookup") > > --- > > On 2023-01-19 15:52:38 +0100, Greg Kroah-Hartman wrote: > > >> Fixes: 5f5a7a5578c58852 ("serial: samsung: switch to clkdev > >> based clock lookup") > > Please fix your scripts to use the proper number of SHA1 digits > > in a Fixes: line as the documentation asks for. > > Done. Also added the comment to the source regarding the buffer size. > > > diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c > index 0fce856434dafd80..2c701dc7c6a37191 100644 > --- a/drivers/tty/serial/samsung_tty.c > +++ b/drivers/tty/serial/samsung_tty.c > @@ -1407,7 +1407,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level, > * > */ > > -#define MAX_CLK_NAME_LENGTH 15 > +#define MAX_CLK_NAME_LENGTH 24 /* "clk_uart_baud4294967295\0" */ > > static inline int s3c24xx_serial_getsource(struct uart_port *port) > { > @@ -1457,7 +1457,7 @@ static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport, > !(ourport->cfg->clk_sel & (1 << cnt))) > continue; > > - sprintf(clkname, "clk_uart_baud%d", cnt); > + sprintf(clkname, "clk_uart_baud%u", cnt); So you bump the size of the buffer and continue to use an "unsafe" call that could overflow the buffer? Is this a plan to submit a series of patches all "fixing" something based on the last change? :) As Krzysztof said, this whole thing is not needed at all. Please fix your tool to generate valid changes. thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel