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 B3894231829 for ; Fri, 20 Mar 2026 03:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773979008; cv=none; b=sGW1amVQxXVWg+ix4ukWb7Uiphb148YgFD82oTaU6IMpczKCIbOB/ZthHU3ODf+7EaiyVzVIjXXrfQkfmzOvxGExxW9ynbf6TyrJcLQOG5VveEayr/PeXVswl1+jJGBKwvwqqW2/J9f76mjXDf/vKZbR8u7+aZxzXea+eDNtkbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773979008; c=relaxed/simple; bh=AD6XTJ75iKEeA/bsIqI1DFjJmL/G3qBOfEh5HXzonNw=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=T96brXRn6kNpS6wC9nO0L/qUyaNl+/phmgaLsdyq+URhZjCixoHR6yIkLoGTC3J1jt/OR7wC2Mh3nNPvroZOkTWQzZ1mG6nCiF90f5/SGJL3fV2wBH/4cKeYwVdNIpnUlKWzjKLS5H7jrr/OKTXOisGHWgENMU0Dc054rIBK81I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DQlu5MiL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DQlu5MiL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE75AC4CEF7; Fri, 20 Mar 2026 03:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773979008; bh=AD6XTJ75iKEeA/bsIqI1DFjJmL/G3qBOfEh5HXzonNw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DQlu5MiLUIj+UzOGKaIb7kvZIN2BZLGMloztnBNbC7GSlqBCcyVrjmxSTPZqWhJLB WkgghwLNVlxj+nM8ZtX3SJGvb7KKdFcEOQwGSNEqCzZP4VoJdmzNpXiNzrsivKnyMI N4Uoo9yG1mW9bwjFmAT41/NOz3BlxzJIE8BEI3xBk1mXxjTOO4vBp3zR79Uff6SuZG gFAUO3pFvXu0pgr6f0MEbzt8eQgAhvfJuAn3mBURxZjEOgv+9WvzgPdW4AUpwxCmCc k7tXZE6KGjhc6aHH4QQamiHrEY2Gq5vbH8gqJJozO8lVjEXjczMk3G/rAOI+ZODT/I DLvmtgHTNHFuA== Date: Fri, 20 Mar 2026 12:56:43 +0900 From: Masami Hiramatsu (Google) To: "Masami Hiramatsu (Google)" Cc: Petr Mladek , Steven Rostedt , Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , Andrew Morton , David Laight , linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/1] lib/vsprintf: Fixes size check Message-Id: <20260320125643.8200cf7334ae92c3e381442e@kernel.org> In-Reply-To: <177397873418.32202.13853628019974387241.stgit@devnote2> References: <177397873418.32202.13853628019974387241.stgit@devnote2> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sorry, I made a mistake on sending series. See v2. On Fri, 20 Mar 2026 12:52:14 +0900 "Masami Hiramatsu (Google)" wrote: > Hi, > > Here is a pair of patches to fix vsnprintf(). > > - Fix to limit the size of width and precision. > - Warn if the return size is over INT_MAX. > > Recently we discussed snprintf() usage in bootconfig and found snprintf() > design has a problem[1]. It returns the required or printed size in 'int' > but the maxlen is passed by 'size_t'. The maxlen is already limited by > INT_MAX, but if the expected print size becomes bigger than INT_MAX, > it can return negative value. We also found width and precision size check > does not work. > > [1] https://lore.kernel.org/all/20260317121507.30735331@gandalf.local.home/ > > Thank you, > > --- > > Masami Hiramatsu (Google) (2): > lib/vsprintf: Fix to check field_width and precision > lib/vsprintf: Limit the returning size to INT_MAX > > > lib/vsprintf.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > -- > Masami Hiramatsu (Google) > -- Masami Hiramatsu (Google)