From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B8F13D34B3 for ; Tue, 24 Mar 2026 16:50:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774371052; cv=none; b=buM+Tx6k6eX+dhSpfErnJt1KV3gzdRpTYEqk8s8Z+Ox8r1tWC1rnwW/3lFH9bFhgLHpcldASMKbf5zPXVO/we4VSaajLwhbBb+Kc9IOMtzb9rpuXBs5R49rijFU6B7q/N7wtiFGzQ6+Hf+Mum3DqlkvWxrp41CBvyuVQg6kz9Og= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774371052; c=relaxed/simple; bh=RfeurgUJuNdUoD0VsLETl5o1yX1a3RYrKnce76D96nE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Af4Bs0TcRBu2/IWnpGib28lBdlodLa4LtDfWxY/pwmNNxYRgH1zaLX0phcGv5/W1z/TFXt6QlWeG21XtBHzaF6bEh0DSZIGXZjKnlKyTj9vNWxC3XtqjxNjWctTKSnD2f8jMv6RkIq5XDiFGdogdOYhAXCELOZNdztRYqJlctTs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=hDrTPh6G; arc=none smtp.client-ip=209.85.221.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="hDrTPh6G" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-43b41b545d9so1506778f8f.2 for ; Tue, 24 Mar 2026 09:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1774371050; x=1774975850; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2M+yxi4WzZqSptvpzwu8s98oovHvRYiBVgQoztK+1nA=; b=hDrTPh6GOLAsg+0Atk+jup0pcdcF6D0nBLssyw8WcNZO+WhAiPhU4vcCbEcDMn/7Up r4PlW+00ghsuCRVf41HspDI+oVUeDfR3t/pqJ6KKPkpgqX4JqrQhjv/uAZFqgDZSU4zv 1q3SoOCrZOfmPK+J252nIjM5u4OdAy7a0j2gIk00M+4ilJbxMiWmL8Z3+akJYg1p9npj 3K1be2U2OF1sQoPuqMIRXAWyZqFyyV1xa1H1qFeo1CCLBcle3LQ5PNTk07N2+JXwXsiw lMrRsPEGS5F3vIJ3DGfsWQArXVmF1uWOlA/OWw7bZrB0FJBZBcuIF51PRySRBcCpMSX0 fAOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774371050; x=1774975850; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2M+yxi4WzZqSptvpzwu8s98oovHvRYiBVgQoztK+1nA=; b=avWUnSmvh1yNZjO2PvFd+HrAnLemkAcmy+URHigmy4QHHcJpCf1GlxlN2/nhJVu8Cg trkQvkYFxOsCOgS1zSAov7qS7q1nFXRsm/gUhSmoGCdNV70brfYCYQKaUdyHoEa5Gpzi oF81CLC1vVvVv/bEnwZyU79IjWN0uskHn3ON/B+Ko358n9/085zQOo2puvWKqAIeqxLs 3+ssFsrYB3mcqSAFiicGhhlqH65KQgoyKTqS8NlmZZH9RZ5CUE2KUzjQikcS41zQSJjT cW8D4sf8roRI2Nrkv68mTOsXJNC/W4JDY3L9ptH5cCHpyCO5JSrCijoe9Fke4pe1pdI7 C0DQ== X-Forwarded-Encrypted: i=1; AJvYcCWYgjFr28lVgBuw6n8zR1E+1P6wyxdC2p29Uw+7bLNLapClrZ2HKuLI66Miwem9QebQsOUJZ3Q7qMw6WJY=@vger.kernel.org X-Gm-Message-State: AOJu0Yyl6DDAsGhN6/SAnD9DECG7n4KpDIkp2eVIVR7uCUohIm3EBnVk mRyDThXd2PJ0pwXdjXRsKhQhzUsDvv0LagKdKGPoDtG4+CtmmflH3BwT27annPPUoUc= X-Gm-Gg: ATEYQzxpPGuhFlDGqTVMXOpdmAnujHnmEDvtYtwQ/TOkrJ+hrMklIegoAhmY5BSneAJ /7irrM5aCNulP7mHj0j9imE6JqYdRA4BFrD+yw+IT3Hjm7R90Ie8q525hHhqatti9sVBa5xolEp t4iF2uJ/r/Rfhl4BAe/LXuRsXv52f5QsBxLSBkTdR5WiS9aotwA6MjMtqRdkfnyXkKFTtc62fGH Jr9MZbXEW40jIfqFWo9Ds8ENXYYG8/2NkRVI30fqzPNmFFT/vRDd7wQauPxIn1AxPAPPNQFY9ps phGD8JbVNgenKbMAooby4+sN7YLIMSM6YVjL/ocwisDH1tZ4N+j/D4e/fEbj/PMswV65r+0SHqT pknhhV5237N/B5eUHbJ7GXQH5Xcv75oJLc5/BgQxYhInhjp3PZ0k6X5bQVHmSIFo4qDDmlv8/Tv BL3JqP0+AxvHChFhQmfn2VbTBbog== X-Received: by 2002:a05:6000:2888:b0:43b:4ec7:f90c with SMTP id ffacd0b85a97d-43b88a086bemr269045f8f.26.1774371049606; Tue, 24 Mar 2026 09:50:49 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b64703c7fsm39341919f8f.23.2026.03.24.09.50.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 09:50:49 -0700 (PDT) Date: Tue, 24 Mar 2026 17:50:47 +0100 From: Petr Mladek To: "Masami Hiramatsu (Google)" Cc: Steven Rostedt , Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , Andrew Morton , David Laight , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/2] lib/vsprintf: Limit the returning size to INT_MAX Message-ID: References: <177410406326.38798.16853803119128725972.stgit@devnote2> <177410408170.38798.4383977339045208453.stgit@devnote2> 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-Disposition: inline In-Reply-To: <177410408170.38798.4383977339045208453.stgit@devnote2> On Sat 2026-03-21 23:41:21, Masami Hiramatsu (Google) wrote: > From: Masami Hiramatsu (Google) > > The return value of vsnprintf() can overflow INT_MAX and return > a minus value. In the @size is checked input overflow, but it does > not check the output, which is expected required size. > > This should never happen but it should be checked and limited. > > Signed-off-by: Masami Hiramatsu (Google) It looks good to me. And the WARN_ON_ONCE() looks acceptable to me. It is already used for checking the input size parameter in vsnprintf(), and bstr_printf(). Reviewed-by: Petr Mladek Best Regards, Petr