From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (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 3EB563A1682 for ; Tue, 31 Mar 2026 14:44:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774968278; cv=pass; b=PmNyqyhdCgnFTVAjoJL8MrlW1OfksuSCypn8LrRdigaEKlNB1QM+wmj2FQhvBMxw0+66vuTPO3gAs1kREpGNtVoak3BUaydWzFZ45Ll+GDu5sosTg2CYWGJzYv38eBVre5zpDusbLKapcTFxDJvdIVn2O0YswCBXdgvxyJNbPZ4= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774968278; c=relaxed/simple; bh=YTltIeSARTTfesgT6cUMSd78yGKIRGOGZc8z6wvqtcY=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=rJJo3hNQke5MFL1ecexZs7Bdt0+HiFbWimE/6t6RF+A1PXseYIPsrSJcyWZlc5xVZL07wi0M4QO2jia81ktMopkQ1PN07rmhBdjYzMqh3dABl4+Bub0hn9xG/ZPGerXEe1wVv4ZV9RhNZqAXSTu86PFECLtI6JcFqK6X/pGT2qg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org; spf=pass smtp.mailfrom=objecting.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b=FBJZepEh; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=objecting.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=objecting.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=objecting.org header.i=objecting@objecting.org header.b="FBJZepEh" ARC-Seal: i=1; a=rsa-sha256; t=1774968266; cv=none; d=zohomail.eu; s=zohoarc; b=VEZvdVv67Z8kWYfwnzppbwsRXIdoMew4FluQhrDB7Rixc5eUHreYstseQ3BWyNObfi03UOKHH6Mi14FIsExCovd+AV67yF/FoCUNiYbbneh7QDxndzrvSUuX4pOgYGlH8PH6/0g4/OVVb0ED/UR86R3KHi+wHVKN65vxROT+5P8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1774968266; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=YTltIeSARTTfesgT6cUMSd78yGKIRGOGZc8z6wvqtcY=; b=dEZjPAQC6OE0Qnr4HqCjHikYviCFeEnaoI7kuPREwcK2QGIXMXshlKrBj+UVbvSi7OtNa6WTpGg3L36q4oTPXUBxvSJvYSQw2m0WgAcbihMFFiTDJWCJhHWrpxVhUBOf7HL24tFaA7OWQNMzorGE7ldijOVlTP6e2uElGoswg4Y= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=objecting.org; spf=pass smtp.mailfrom=objecting@objecting.org; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1774968266; s=zmail; d=objecting.org; i=objecting@objecting.org; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=YTltIeSARTTfesgT6cUMSd78yGKIRGOGZc8z6wvqtcY=; b=FBJZepEhvR0UeEHmYT6sCok/qjyZ1weXHKoWMdDxUwev+Vyf+WbaJroO2zhgN179 ZOyp3Mfr1uvzfolNAMjERkjYMXZtm+c2hNuSTaYci4U/lXvdW7Iy4ATPivFb/xG+MMW xPI0NHLp+QDKVux5ocH7Bs9JrJVcOviVvyqaaesg= Received: from mail.zoho.com by mx.zoho.eu with SMTP id 1774968265936468.654272022633; Tue, 31 Mar 2026 16:44:25 +0200 (CEST) Received: from mail.zoho.eu by mx.zoho.eu with SMTP id 1774968264293139.76350253305668; Tue, 31 Mar 2026 16:44:24 +0200 (CEST) Date: Tue, 31 Mar 2026 15:44:24 +0100 From: Josh Law To: Cc: , , , , , Message-ID: <19d445a5664.33d1f004100812.7921826944404465165@objecting.org> In-Reply-To: References: <20260324224940.50508-1-objecting@objecting.org> <20260324224940.50508-5-objecting@objecting.org> Subject: Re: [PATCH 4/4] lib/vsprintf: add missing (u8) cast in format_decode() lookup 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: quoted-printable Importance: Normal User-Agent: Zoho Mail X-Mailer: Zoho Mail ---- On Tue, 31 Mar 2026 15:33:53 +0100 pmladek@suse.com wrote ---- > On Tue 2026-03-24 22:49:40, Josh Law wrote: > > The first lookup into the format_state table correctly casts to (u8) > > at line 2778, but the second lookup after consuming a length qualifier > > does not. On signed-char platforms, a byte >=3D 0x80 sign-extends to a > > negative index, reading before the array. > > > > Add the same (u8) cast for consistency. > > > > Signed-off-by: Josh Law > > > --- > > lib/vsprintf.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > > index 2758096b6f53..3108823e8c22 100644 > > --- a/lib/vsprintf.c > > +++ b/lib/vsprintf.c > > @@ -2783,7 +2783,7 @@ struct fmt format_decode(struct fmt fmt, struct > printf_spec *spec) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0fmt.str++; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0fmt.str++; > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0p =3D lookup_state + *= fmt.str; > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0p =3D lookup_state + (= u8)*fmt.str; > > =C2=A0=C2=A0=C2=A0=C2=A0} > > =C2=A0=C2=A0=C2=A0=C2=A0if (p->state) { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (p->base) > > This makes sense. Even though the current code is safe as pointed > out by Andy. > > Reviewed-by: Petr Mladek > > Best Regards, > Petr Yeah, better safe than sorry in my opinion. Thanks for the review petr!