From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender-of-o58.zoho.eu (sender-of-o58.zoho.eu [136.143.169.58]) (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 AF1BF36C59B for ; Wed, 18 Mar 2026 07:48:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.58 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773820103; cv=pass; b=q+tdAZim2O7jRgGhjBlBMCI8Expc1nkdAhlHS8Fe+i6JHVjqcwy38wZmE+KjXewhLfNGrv2vxH0GihnlYMHVppExzVZsmY4xPc0ATieSd0s1j6pDE/pYPzwuhjGZMq2PWfoMQ3MJ5kA9x3iDW0K1hbvKxSf+aSKFS72V7ADgSRE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773820103; c=relaxed/simple; bh=nIN8GY29pezALbRZyv6JK56BWMfm9W54LMPoR5NS1a8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XbhhkgwsW9u3IQrKGkfDyt2IjD7Y43TCTD+Vvh6q0MZvyYGxpZfpFdXRsOBHgetrfwslTjaxCfcnLDddnQMaf40+RBAXanYaZf6jYNGuf66/hC/rMUzUhHefOK80Xh0N8E78cxYL8mrNPSJrNnQszMSb/6ZvPA+ugUhQMwQJyUU= 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=VUU+4VWq; arc=pass smtp.client-ip=136.143.169.58 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="VUU+4VWq" ARC-Seal: i=1; a=rsa-sha256; t=1773820091; cv=none; d=zohomail.eu; s=zohoarc; b=OjWzijOm+871gQD9Zyz1D2eTtuyB4V3NrA8KMI/HWhTVe/n+3HkMSNCE0Z8cA2n3EkTgtnK7IHCoKNQ/X92uKfgoXEIPZzB5Ioc00pt0/ragj6A2JYor9e1xWn3u7neV6v90Zt5Htb3drxrmPv/mkmTB/zFLFe2aAX5ONsQXJss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1773820091; h=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=4lBSJtzOw0LOnnc46lo+WIEvaGjPS2Jvk55h3jkpmPY=; b=d7l8qT2tYvbOXlFHLWsTcMnHigtLaSGxijh8rfspdSyzQMW11psH8JVHYl9ndhsA+E7n3EUXpocu50KYZptZcqQj4Xa6jlfK8UhSJTc3osv0HPbLb6gYDSwOjwIUtcB5s2EOTULs39zOW/studM52NW7eDPu9tJcABVvRcfhen0= 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=1773820091; s=zmail; d=objecting.org; i=objecting@objecting.org; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=4lBSJtzOw0LOnnc46lo+WIEvaGjPS2Jvk55h3jkpmPY=; b=VUU+4VWqpBzAKX8eKnpoqIvIlz2PBjZB37A0dAYrEGaNzJYPdLLuUzTDuX1j3scR fclhDTzp0bxzbDYKkHB26LrxOWMISZtjMJtWdQY4qs/4pGHgiEXJtZTGEUijOOtmRNu FffEf5xbNTMfcCDFUWPiRC0d7fQ7uwcLjkCo2fNg= Received: by mx.zoho.eu with SMTPS id 1773820089278692.4280811145746; Wed, 18 Mar 2026 08:48:09 +0100 (CET) From: Josh Law To: Andrew Morton Cc: Josh Law , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] lib/bch: fix signed shift overflow in build_mod8_tables Date: Wed, 18 Mar 2026 07:48:06 +0000 Message-Id: <20260318074806.16527-3-objecting@objecting.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260318074806.16527-1-objecting@objecting.org> References: <20260318074806.16527-1-objecting@objecting.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External Cast loop variable to unsigned int before left-shifting to avoid undefined behavior when i >= 128 and b == 3 (i << 24 overflows signed int). Signed-off-by: Josh Law --- lib/bch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bch.c b/lib/bch.c index ef733f08082f..c991c71c4cbd 100644 --- a/lib/bch.c +++ b/lib/bch.c @@ -1116,7 +1116,7 @@ static void build_mod8_tables(struct bch_control *bch, const uint32_t *g) for (b = 0; b < 4; b++) { /* we want to compute (p(X).X^(8*b+deg(g))) mod g(X) */ tab = bch->mod8_tab + (b*256+i)*l; - data = i << (8*b); + data = (unsigned int)i << (8*b); while (data) { d = deg(data); /* subtract X^d.g(X) from p(X).X^(8*b+deg(g)) */ -- 2.34.1