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 9E3C475809 for ; Fri, 20 Mar 2026 03:54:43 +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=1773978883; cv=none; b=EnV/yji6jfix0sVBYUqUKWFbDLspuG+4nwOglCLMWyTo1IhCKmzQJ7gjYJhZsjmDQ9qns3BvDzfwUGptYW7AjSCPUk3MxgMkkUUFkdkaUBbmJ8Y8GOmKFA4TathrPj2iSn4l8VT0PpNbs40dNdOh/mJUhCeAcvTq82DFSqziQNs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773978883; c=relaxed/simple; bh=icBseSlhWE1Gkk2z2U3iVmemZ/fIuQKk84jxbilTgK4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DGH04uW7FyqdT5U/GVKYJPNSn93H+m9DJXB++PEV5cB5K6iXVMmtV4GXItnDNPV2azM6dP47w6TTfVOUJQ8R6VvAAMQnCuTNRBVNb6O3Ya5fCz7k7jBl77cxG900go3q3svja8e6TYQeKP4npwMcmx7FnsRZ0J3NfsxW4k0PyGA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TlBlxI7F; 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="TlBlxI7F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 743E6C4CEF7; Fri, 20 Mar 2026 03:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773978883; bh=icBseSlhWE1Gkk2z2U3iVmemZ/fIuQKk84jxbilTgK4=; h=From:To:Cc:Subject:Date:From; b=TlBlxI7F2K5LK3Dh3LxsBL6t1mucjxbNTAikDOJPTWHLLTHaXLgJJlNmLQDsYQKHy F1hTz8QW3FJwhTXCNwDGM+ljaikb+Zo7QfaQknh0Lwm/sW33MduZoMLF11PZG2LlJn uiHttB12YvzwF7wJC11D+q8q/kJdAheiry9V2o7xCZbrIuLughtPhaVhxMQSHfMNkV Jas1rqA3iHRudls+iCjOT+13uGGD5870MdSlLA0swd1avfcDgqH3vbiNZU9/inXDjF IWSY/8BgmNsglkg5eygAD3k8XJKYbP3Zkn7Be3besT1ZjiC4xLe2rSjgWea8AW9eqn 05PfxRMoPVMLQ== 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 v2 0/2] lib/vsprintf: Fixes size check Date: Fri, 20 Mar 2026 12:54:38 +0900 Message-ID: <177397887883.33018.9867883986177366222.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)