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 3EBE63DD525 for ; Tue, 31 Mar 2026 14:44:36 +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=1774968277; cv=pass; b=XfYRnOmQruBLJ+xkz4M10R2y5tSHPvQLhv86XvFmNfMpCEJdPzZ9CXUJE5BhvWvDJbmbhB71/feSxkz1rAytzPOowsjP138jmb6LnNDpt+pvbUmrOvV6i/+NI60y5HlYjIvTQ2YKwfUBXsC26hGkVcLylV91z7T8enWl048AEcY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774968277; c=relaxed/simple; bh=YTltIeSARTTfesgT6cUMSd78yGKIRGOGZc8z6wvqtcY=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=D5dNiGkJuZF0OaDKTV0zVlPca8qmLZPRP/uzv3xbyGR1oOKlqpa96DDlzvigCJbMXXCpgouGqEV8itE7PuObiC30h6BG+hnEJble5VmL3N+plHR8d16VXu/p3h/0lWYtgS9R0gE4Sqz9EZVr6j10inRnF+IPwbAmXwBefNXzRLk= 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=KT3XyHa4; 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="KT3XyHa4" ARC-Seal: i=1; a=rsa-sha256; t=1774968266; cv=none; d=zohomail.eu; s=zohoarc; b=hf2MRRcZ/UJzDdt/fAw6SLmX8dOxvWtTo0VdTTqArbNchAZzRbd/0Vadbb/dr3ZemHfD2WHmWepRkaGoDWi/evvBSsAh6fNwXaD+b+HIcVDZJWRe3VLQTyIO3QoHW5iPzlGBJxGrgJ3oJSJbB1fqE6QhVUWgpUQki/cu1ntT+do= 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=CbebqhX7yqs5pPWzA0OmGB2QDqEgoi/xrr1/0FWAL+2UMVb14t5o5jvPnrooR+gXBZ34tGPYOnbjc6zYfTRL9oq8ulwkOygh36kC4Su2exX2sfTC4GMp2O3jHj2cIT7QfV3BK13hH/pFgT3JGnLPZblUd6YjJA/T+5+gSpGFRAk= 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=KT3XyHa4TXlvu4iZIaKf7WDSEjjf89uIXnJ9ju2i7vFFC4/Pc7ZyjONVxDKvaE7q taixvA3dLlHFTf3FU3hZ8ATjds8kqXLw7oe/JNTyLPcosNXx7Ov1z7dwSZNBGPdk6rH o9Gyo1ZgMAKasaGeUfYLYEvU1WFQjTrvnkobBYTM= Received: from mail.zoho.com by mx.zoho.eu with SMTP id 177496826593698.93323364536923; Tue, 31 Mar 2026 16:44:25 +0200 (CEST) Received: from mail.zoho.eu by mx.zoho.eu with SMTP id 1774968263918772.9296026236125; Tue, 31 Mar 2026 16:44:23 +0200 (CEST) Date: Tue, 31 Mar 2026 15:44:23 +0100 From: Josh Law To: Cc: , , , , , Message-ID: <19d445a54ed.6d9a96e398729.3161855776737149670@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!