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 D193775809 for ; Fri, 20 Mar 2026 03:52:18 +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=1773978738; cv=none; b=cF3kfuydI7KFbHeBfu/jEjaDVBTWmKjVdkIHLXB+EHBiy8vg7s1VEMzS0mVMwXoFUV7uGyN2FKC2dPrSDRxibwPxIL6zzRv6WqfNHr9qxHQQK4Yr+ftp0POKswXVqlILK6Bk0t+dA3K+ilaflseRi9nwRLZnXGbZMPnWz0VuBho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773978738; c=relaxed/simple; bh=icBseSlhWE1Gkk2z2U3iVmemZ/fIuQKk84jxbilTgK4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=E0av+GRyxDS/YlIkWn7N3ULvIzr9840tRmWD5oTZJiFUdYqzsdGuEQPt2Mjp5UwWuFfjNLW/X54jmx9sNnOVT42wDU/asL/+sIr9UK4/51cLz8H702xHJe78GvJE8sbH+KS37J9zuXnUhnzQQ6Q6ZWKG8s1r6YKNo2B5TjX0cgg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YK5Lflrh; 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="YK5Lflrh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A56FEC4CEF7; Fri, 20 Mar 2026 03:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773978738; bh=icBseSlhWE1Gkk2z2U3iVmemZ/fIuQKk84jxbilTgK4=; h=From:To:Cc:Subject:Date:From; b=YK5LflrhIdp7MDGB9SH2wf+z12eBmuOwVzz+4QsPRyMBBXcZLyUoj1Tw9xLsOh4GY lyiAGIDQKrKAYbGAQYMQM92iYscH7J3QPBiQqxWgjbYF7rEw606LInFHSaJdeJuAAi mTwAY50EdsHqQqESsEg/JJxDYjNA6MMweYLNjBQ+jBoUuSascCuc/oYO1kzC3zNmid ZtMc/HVyOmCcnJdWCvnFfepcCQ+bdEnti3VOoG3AftlUZTIb3P/psF354VXfXYAxIC +rku8aOq6jEwu+BAScVN48j6NY9z3y30Pc7x4wlcY355Azukhy9wjUYnoC+7l5YWaD ghJ0eshmN6phA== From: "Masami Hiramatsu (Google)" To: Petr Mladek , Steven Rostedt , Andy Shevchenko Cc: Rasmus Villemoes , Sergey Senozhatsky , Andrew Morton , David Laight , linux-kernel@vger.kernel.org Subject: [PATCH 0/1] lib/vsprintf: Fixes size check Date: Fri, 20 Mar 2026 12:52:14 +0900 Message-ID: <177397873418.32202.13853628019974387241.stgit@devnote2> X-Mailer: git-send-email 2.43.0 User-Agent: StGit/0.19 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="utf-8" Content-Transfer-Encoding: 8bit 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)