From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.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 298D7377EA5 for ; Mon, 30 Mar 2026 16:06:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774886793; cv=none; b=DZNt7peBSQ1YgELxES4s04C3DhEDoiiCIRxvG2GsM11oE30/7kMrr581DTDEKpt+nvUiryJEDAkn7j/IENHHVWG0oIyxeev/OCErCfrb/0zNbn90UIRymF/l/TJnBe7k7cYjgEfXEh2/cX47JyYMkJcJ7iGqZ2YMe0jTQunAKhU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774886793; c=relaxed/simple; bh=aSyxNnrmuR8eRvNrsdXjn0YMVeYW3l8fGSpb67Ik3aI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ted869sq4kbt+giFZ84slG8ZhnaYxC/3fW0l/smemlt3SBNBf/oL8Q8ycMsyhknKTQf7ds7I1s89nGIKStUbdahZZQTeZsP2hJbwiSX0Ck7qowVKnOLG/rZw173iGDC5AHWt7q5Kf+EOdi63bbzeZaEpQREUB2tZBUhlLL6Rhrc= 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=KlGMCb2/; arc=none smtp.client-ip=209.85.128.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="KlGMCb2/" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-486fe655187so60979425e9.2 for ; Mon, 30 Mar 2026 09:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1774886790; x=1775491590; 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=Vd4/tYkHgLakTDx60F42DSs825Klp1jniVt0XmhiuJU=; b=KlGMCb2/Zs4s93YNLdIgYkubhRMeo95aKmMYqdEwp//y1KnwO8RQxb3TgWQiBKHX04 EwCnqhDxCoGM5+AONFgIbOOu34k4UBwm4agrOQ3A2YZwqmLPECrpPO34+nMVuKEiQotR U76Q4otbK5NxVv7lMV97d1+4yOPif9g0gWKUUJUA5gk7V/D2G4dcQgtJu7Xbt3oEkxaL Gf5GLhh8mtYWnVAMn7NcBGftY5oHig2zJkVmXI+E+8RFUgsqTpLZrZbPSS7puuH6JI9F 0+56bVpJY7/H9fR24HWErGmsAD9TdyUsC9SVH0IiELvVMN7f3CUOSZdmHz/SF7tcyM6B XAMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774886790; x=1775491590; 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=Vd4/tYkHgLakTDx60F42DSs825Klp1jniVt0XmhiuJU=; b=ZLn554wssPwzwGNVwFoN4iUE3D7NqoY3LVImhrQlqhObrOTaYU5v12dsyFlxLsgxO+ ER//6X2jaIZl960vxwcfqoOCfp8MjdudbXdrq70BsSJjDowMWN3A2tZw3mB+4D7WxUYW MF+9gXvLgUer92VzNE5XPpaGYL83idkBI6IZF1CvC73u3Zi9K9zDOvEoU08g0S9+P7aO OaY74nbI/lo8VPUgWxuX+TMGF8pp8uwzbzxkRVmRz9qRluyunWYBTiUrmgz5NSYtDuMB CLo/hGC27nAMO5j9MNLE5/5xf+RJFEakc5jv3RNzoVuDfdduXirEvKCnzW5ly0W1dblx M46A== X-Forwarded-Encrypted: i=1; AJvYcCUUFUiyFRlc4uNDCiILKjozghK5Bpaoxs+ZXqQW/t9EGI1F5aKcJfvHYqc2LaUj0Z+21VGdwb27HGacsB0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9WgLj9VaO68eyTPSsvIzTTwMfSR6pC8ZxMAAGwYbN3qHXWxtg zaGGDPAz8pSNrRTffydUVTOvlf8ij3zFMoE8w+aJ2wtkxtlIUW87VqMFH/taEOb8SLA= X-Gm-Gg: ATEYQzwpORlXHEPsjbdzksyPZQBZHVi68srocaXTP5+1+FDrXBL3vHe4I4HX7u5rlqG 1qYfLwxeNOlbPxH68CtdfnpYuhfXwUDcQye5y/ugWHpex2BSERluBFkK8xhBmwTg82YuosrivYO 6Bf/5x+zZc8T+FpZ2/pnKfN5NwFrv07syeswT3ZuAxsZuO1aT5WEsrSQ2IeKOi4aQNQsQOcF1hU V0qsxAXYb4QizBlW+esOaKL7/MBzP1TslLH9qP6EA/z5qbLIUMcD/i10YCswjV75LY4+s+QivMt Q9mZ/2tu+BQsFEnqb7aDjg1EGyN5rs1KXtGZHksRk9zAjZFaOAgloW+aGMz/n7DjtCME7no3mG1 tKi9roiZiTWZAE3gj0CPNmGX9dFffYHNI4Aj5C6NmYwVDTjs7tr258vzifTQUjrvbSNZqZ4rOyC Wht31KDpJ84n0nIwM2Mp9NjV17zw== X-Received: by 2002:a05:600c:1d1f:b0:486:d76c:fa57 with SMTP id 5b1f17b1804b1-48727eb81bbmr241952275e9.17.1774886790447; Mon, 30 Mar 2026 09:06:30 -0700 (PDT) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48727189cd1sm82621035e9.29.2026.03.30.09.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 09:06:30 -0700 (PDT) Date: Mon, 30 Mar 2026 18:06:28 +0200 From: Petr Mladek To: Josh Law Cc: Steven Rostedt , Andy Shevchenko , Rasmus Villemoes , Sergey Senozhatsky , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/4] lib/vsprintf: always advance args in bstr_printf() pointer path Message-ID: References: <20260324224940.50508-1-objecting@objecting.org> <20260324224940.50508-2-objecting@objecting.org> 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: <20260324224940.50508-2-objecting@objecting.org> On Tue 2026-03-24 22:49:37, Josh Law wrote: > When the output buffer is full (str >= end), bstr_printf() skips > advancing the args pointer past the pre-rendered pointer string in > bin_buf. This causes all subsequent format specifiers to read from > the wrong position, corrupting the rest of the output. > > Always compute the string length and advance args regardless of > whether there is space to copy into the output buffer. > > Signed-off-by: Josh Law It looks correct to me. It is interesting that nobody found it yet. But I guess that all users of bstr_printf() are using big enough buffers so that it is hard to hit in practice. Reviewed-by: Petr Mladek Best Regards, Petr