From patchwork Wed Mar 27 14:14:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1916797 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=U35cq5xN; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V4TGH1Pz7z1yWv for ; Thu, 28 Mar 2024 01:15:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 26FBA880BE; Wed, 27 Mar 2024 15:15:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="U35cq5xN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA926880BB; Wed, 27 Mar 2024 15:15:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2417::600]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D4FEC8808F for ; Wed, 27 Mar 2024 15:15:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YkbGLhvTT264e8IM+aYhB4hM/KCBwJ/hGbwnKdhFihUAgePajpcQdkbZRibakiUu7iynwoBahdcFB714+NudxXhe6AT5YHscBmnzbcelQ6by1vOGd3hvdVGBc6fDINiJmjMdz+GojhMi30ZLzeXURDKVe63iMY6jfZ3TcjsJr4et6SgWocwmcKj7x4UmHqf4WDsT/SZXksC+i78qOwlxv1u9K1NB2LoOwJKXvMbJeuYhXg4zWB/oyMmnu68iUglAXUf2wstMbLk1nJaQXhG+UgEt+bg0Mp2wM4r6i8aPy60kpmxSEsoFVsWE03B7cbC+zF3R3rOcOxnL/4a7MHLJPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h/sgJmlncKuQQ2zy8AqySWQEZOgKugWBrboqyJxAzdg=; b=g40ajSj34x1yOpXPX1u0rgG3m1cQ3k4Y1SJEkR5yQVa+WC4LlJdJS9fcVZonQQV7no5bAlj1j+8u6D7fB/GYA5OCuhELX0cQX9PrFHKBhy5nHqGLMqhmbUMdCP/f4SgSCjsq6OmDTnVmYZ7MRVuSYv3Z975qhlDZasnBHnIQpxstgxgpfgyB4gC07uKMHbucI0YtOUu6I/kGwF5XsSp8yBW4fDd0bkJcu9lfiO205Paz2usqw9Gy0AiKNe/PP4rSwi1lGauAInfUnSH9ajgoUBpvPK+WfJpPHmZpuVTgVHg9/SZ7cfxo+BILfaaLQX2MFnKB7NosW51c5UC14F63OQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h/sgJmlncKuQQ2zy8AqySWQEZOgKugWBrboqyJxAzdg=; b=U35cq5xNlzIBh26yhU9KMiRDK4xZr+d+DtDJRLWonFqYyftXYoYRvtAOYnFueP2c+XACqA+tTLmjLViqkHu+2uvSRK5WIKk6iPZ3IQPVj+BOR8+eftlHPQ57LM7axzPpnksCQbkpYVX26IGiySvfPLVi6qw7ENAWpfIF6hqYHtk= Received: from BLAPR03CA0070.namprd03.prod.outlook.com (2603:10b6:208:329::15) by IA1PR12MB8192.namprd12.prod.outlook.com (2603:10b6:208:3f9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Wed, 27 Mar 2024 14:15:03 +0000 Received: from BL6PEPF0001AB51.namprd04.prod.outlook.com (2603:10b6:208:329:cafe::d8) by BLAPR03CA0070.outlook.office365.com (2603:10b6:208:329::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Wed, 27 Mar 2024 14:15:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB51.mail.protection.outlook.com (10.167.242.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Wed, 27 Mar 2024 14:15:03 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 27 Mar 2024 09:15:00 -0500 From: Michal Simek To: , CC: Tom Rini Subject: [PATCH 1/4] zlib: Rename this variable to here (current decoding table entry) Date: Wed, 27 Mar 2024 15:14:50 +0100 Message-ID: <37b3beb34aeb6b1f03ced7509fe3d7262d2406ce.1711548887.git.michal.simek@amd.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4097; i=michal.simek@amd.com; h=from:subject:message-id; bh=s5l0xEKW1Der3W2q3r/EGYHLFEQLRl1FJ9uOSLN8Ry0=; b=owGbwMvMwCR4yjP1tKYXjyLjabUkhjQWzXt9KQVP1xm5RXF0L1PbuI594hPZjfte5iyMFFI7K CupHne2I5aFQZCJQVZMkUXa5sqZvZUzpghfPCwHM4eVCWQIAxenAEwkPophDh+j6qw5wnd0bn+z ePzx74Wt9aIb7jHMd+8/EsLKteDcrWIppxD5cz05Udu9AQ== X-Developer-Key: i=michal.simek@amd.com; a=openpgp; fpr=67350C9BF5CCEE9B5364356A377C7F21FE3D1F91 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB51:EE_|IA1PR12MB8192:EE_ X-MS-Office365-Filtering-Correlation-Id: 8da3e1ba-303c-4399-aeab-08dc4e684ba2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o/JC0i1hwrbLZNDD4FKu0p2WuWCVkuHa6JGMXRaWvcJmPiK8n37OgqEw79HsPJBUHvTPfqyfmQlK/k1z6xNrfoaSriYhyLHCZtIqrh67rlAJrqvTSthSM+8uopVnpjfCBz++9eeCmLRWYEijILfvs6grQycdZfDf2oXdL9A4p6zT+W23faZDqFdsITKuFz6igGPW8qFmYSL8kxuaPOwtHlK81n4XqGN4ywTckErR1LKjCBtZyP+li4wpKbPR1lgC9MNvKqGCM/gj8OoDk8UNXTdVmlaJESWe+RgKJHR+98dtijxVyGTwZXTQjvWDWOAKb6cpcAwsBriffPbdwKDnOLjb+s243fWqcbYE4fQITVj9NKFNqxqZ8k1IQc0VYs3rJ6NPPcHkcFnyikU48bNPxf5hPc7Ouipm6lM2LcruBZQTRbe9tRHqleJU15cXzeGWEmfp5F+b88nIYK9uhHZs+M7Ay+CsfFP5ERapPA38oFSFFH44RDbF3dAikljHGuYq3LixfbkqXkjVzhnisGUf/Cm1jodb/WkCAKbAApKz7z1wGrZM584imle4jZtk4HliF52DLQ2Qsz50FGKPPPygwANxZ/wjbo682CBnV8PPfJsEgxek0JoGEYIn8NkTy/Q79JkwkJocHBqcmQV8hmRLLyh+/AtPKwPSILtT2dFo5YADfhFffILfD39n9IGxDtdEuxbFA81da31fOcBHlI2XMj5ql9mOYUsWgwN9KawFGwjFMUVH8y5ixW3slh3aLKz/ X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(1800799015)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 14:15:03.1817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8da3e1ba-303c-4399-aeab-08dc4e684ba2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB51.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8192 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is no particular patch/description which described the reason for this change but it was done as the part of zlib 1.2.3.5 release done by zlib commit 639be997883d ("zlib 1.2.3.3") It is preparation for followup patch. Signed-off-by: Michal Simek --- lib/zlib/inffast.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index e3c7f3b892bb..d61cf0e72af4 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -88,7 +88,7 @@ void inflate_fast(z_streamp strm, unsigned start) code const FAR *dcode; /* local strm->distcode */ unsigned lmask; /* mask for first level of length codes */ unsigned dmask; /* mask for first level of distance codes */ - code this; /* retrieved table entry */ + code here; /* retrieved table entry */ unsigned op; /* code bits, operation, extra bits, or */ /* window position, window bytes to copy */ unsigned len; /* match length, unused bytes */ @@ -133,20 +133,20 @@ void inflate_fast(z_streamp strm, unsigned start) hold += (unsigned long)(PUP(in)) << bits; bits += 8; } - this = lcode[hold & lmask]; + here = lcode[hold & lmask]; dolen: - op = (unsigned)(this.bits); + op = (unsigned)(here.bits); hold >>= op; bits -= op; - op = (unsigned)(this.op); + op = (unsigned)(here.op); if (op == 0) { /* literal */ - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - PUP(out) = (unsigned char)(this.val); + "inflate: literal 0x%02x\n", here.val)); + PUP(out) = (unsigned char)(here.val); } else if (op & 16) { /* length base */ - len = (unsigned)(this.val); + len = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { @@ -164,14 +164,14 @@ void inflate_fast(z_streamp strm, unsigned start) hold += (unsigned long)(PUP(in)) << bits; bits += 8; } - this = dcode[hold & dmask]; + here = dcode[hold & dmask]; dodist: - op = (unsigned)(this.bits); + op = (unsigned)(here.bits); hold >>= op; bits -= op; - op = (unsigned)(this.op); + op = (unsigned)(here.op); if (op & 16) { /* distance base */ - dist = (unsigned)(this.val); + dist = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (bits < op) { hold += (unsigned long)(PUP(in)) << bits; @@ -297,7 +297,7 @@ void inflate_fast(z_streamp strm, unsigned start) } } else if ((op & 64) == 0) { /* 2nd level distance code */ - this = dcode[this.val + (hold & ((1U << op) - 1))]; + here = dcode[here.val + (hold & ((1U << op) - 1))]; goto dodist; } else { @@ -307,7 +307,7 @@ void inflate_fast(z_streamp strm, unsigned start) } } else if ((op & 64) == 0) { /* 2nd level length code */ - this = lcode[this.val + (hold & ((1U << op) - 1))]; + here = lcode[here.val + (hold & ((1U << op) - 1))]; goto dolen; } else if (op & 32) { /* end-of-block */ From patchwork Wed Mar 27 14:14:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1916798 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=YL6hFKnc; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V4TGT0WlZz1yWv for ; Thu, 28 Mar 2024 01:15:29 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9642B880E8; Wed, 27 Mar 2024 15:15:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="YL6hFKnc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D256880DD; Wed, 27 Mar 2024 15:15:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2412::600]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3C8658808F for ; Wed, 27 Mar 2024 15:15:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OZu59Z7EWDr5O+zkuLUcUwTFqEgLEhq8Iuh8l0T6Rm+e4FO5fXV315FciJAg4pql5VeSF6HtAPGg65JitcNL3VI9lGAMeaEWU+XRCaIL2MarMmnQB5TIC1hKGJO3g1CGq4LxRaj7q5vwmHNI7eVHG16ThDZwe2Vxy/4FT0gfm7nMY6aIdVXPBNiCkBDoJ7CzHVGgYjFvAfZCNuIWAH8qpFwSZIFqORGPWBWCfuESvysmdI5Z1YRhuAADT2wGzqQzikAJSdZhYQ4u7uz2FWiymiJu0wQbxSa8YBqyEPSotab2qvfK/mm+Idzgjo7OG4CO7q2U9P2sWVwtxjdZZcOazg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S7pkwGtRKKsJnMUdDAOh1dob7MIHBxD6yRmifjusUU0=; b=WjW+aRCq6zOiFdCmh79nkQn5pXq+9M6nzt7cOzvKgm7RyVsVjyvJ+I3MF+oI3E0VLrhoawV6MAXoMJi9I0uccuKH9Ym4rnV+WDHHbVoHRrqx/T5CwZarMVGsvvUGagn+fQ5j06wXtMTvSzSEPU0GNhWcZnLc59lVFRBnxCrw3iNvsSOhGa5vUy5RaZduIR4X/yAel4Xuom5URLyZ9U8Jx+w8yCr7BysH3plp30/DUuVUP2DqocdSOmvKMWG3NPmxB6MBoZPgDvFWiKwMReTBgWRyCN5G/MQKbsyNxTVJK8lgOnX2JMLMJ9eJA0OlB6OHrLYO8nIc/lruGZX61NgG0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S7pkwGtRKKsJnMUdDAOh1dob7MIHBxD6yRmifjusUU0=; b=YL6hFKncLDejLVNvONHjnyPOaRy4d7UsjjKAUTWUcOIyIN0w5rXQfCIDFN0Nto/QEkyFymOZcemY0DUCYcURdO4ABHCjSk6WxuyWhB5RPyTEueICp5PeJtg7o+u/7VldUag0klOmiSrr3LQvc6rQRlUw8CkEXCc4X55N2NB9Z4k= Received: from MN2PR17CA0010.namprd17.prod.outlook.com (2603:10b6:208:15e::23) by MW6PR12MB8663.namprd12.prod.outlook.com (2603:10b6:303:240::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Wed, 27 Mar 2024 14:15:06 +0000 Received: from BL6PEPF0001AB4B.namprd04.prod.outlook.com (2603:10b6:208:15e:cafe::db) by MN2PR17CA0010.outlook.office365.com (2603:10b6:208:15e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Wed, 27 Mar 2024 14:15:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB4B.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Wed, 27 Mar 2024 14:15:05 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 27 Mar 2024 09:15:04 -0500 From: Michal Simek To: , CC: Oleksandr Suvorov , Tom Rini Subject: [PATCH 2/4] zlib: Rename write variable to wnext (window write index) Date: Wed, 27 Mar 2024 15:14:51 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=7677; i=michal.simek@amd.com; h=from:subject:message-id; bh=UmBaxxZ/AhGShWt2PzU6aVuOnaNRO2QcqFuv0rabsw4=; b=owGbwMvMwCR4yjP1tKYXjyLjabUkhjQWzfs5dndfPtzJk1h0tC74YcSTyE752cJ7mGVMp4RO8 AnOluXoiGVhEGRikBVTZJG2uXJmb+WMKcIXD8vBzGFlAhnCwMUpABPZu4Jhnjbb4dfWzcU/y3ds SPVeXub9/dYTLob5/qcsvSXa/Do8tgXdElFarL0vseQTAA== X-Developer-Key: i=michal.simek@amd.com; a=openpgp; fpr=67350C9BF5CCEE9B5364356A377C7F21FE3D1F91 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4B:EE_|MW6PR12MB8663:EE_ X-MS-Office365-Filtering-Correlation-Id: e00d15d1-9a74-4b4c-9574-08dc4e684d3c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dIFx7EivammeFdV2DrPnR7sfL4hknh9e0iFCbQF4mWbxd9ZUnQkGtQNmeZ7AXAnd3AWCmelk4wLC+4ugiWnMrPgXJzJxqjK0bxqBgeOBNu78GyQBiU6thlj9Ipdy11kT7NLx4Osrz1vEqtzcJDicokMygR9QWlnkckW5SUnfRNHXGkt4OKCSWbNEAukBcZPdfnYU8XHDep6D9PqoZeGEHpkp9ndDp7qcqnVLDr9T8jTXOr7qmzb6lE1trIlS7rbE5E8Pp4mHraPunSwAIWCSi1tgwn7Qn1GNdsTbt+GWfudsgp1R6LkbO9CwvVgLR8Jrifgbiiv+1Efz2qq8CmsnKH2AUiym0+7HlejjkHcW4ByiAtpEkKdO+K6C38jhSHkMPjirOoLSl5okbHtwAQZfeCZFLm0ZL0OYgckUFShpBPVZyMxegiozK1wfh7LJfr4MURebc5mJqT7QIQTHaKBNJlVZrxuoEi5kfA7vgXW5zOPYhnxSObBNGxO9LG8OBC3B82FTgO1SgADQunNdKzz8T29PIhagHvqxlWHx1NwMt26j861o5u51QK2mx1pIcJuAeI/CdHZNc4jloiaOjtNnXtWLE5/HzKzH2TpZq/LRR0ivvCuQypdAduWFlE5P840aqxZrgI2nWv5mppS1834YElGsrEe4jxjfbX1kT2Dyb8m92hhZPuyM4joCAe0sFrhYkfflRT7mcVwDuSlD3MdWdCHhsSM5zSlO5UEcCyvlU82ZINF9nCwtccgu+PIxcIlj X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(82310400014)(376005)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 14:15:05.8680 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e00d15d1-9a74-4b4c-9574-08dc4e684d3c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB4B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8663 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean There is no particular patch/description which described the reason for this change but it was done as the part of zlib 1.2.3.5 release done by zlib commit d004b047838a ("zlib 1.2.3.5"). It is preparation for followup patch. Signed-off-by: Michal Simek --- lib/zlib/inffast.c | 20 ++++++++++---------- lib/zlib/inflate.c | 22 +++++++++++----------- lib/zlib/inflate.h | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index d61cf0e72af4..bdaa6d0dc51f 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -80,7 +80,7 @@ void inflate_fast(z_streamp strm, unsigned start) #endif unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ + unsigned wnext; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ unsigned long hold; /* local strm->hold */ unsigned bits; /* local strm->bits */ @@ -115,7 +115,7 @@ void inflate_fast(z_streamp strm, unsigned start) #endif wsize = state->wsize; whave = state->whave; - write = state->write; + wnext = state->wnext; window = state->window; hold = state->hold; bits = state->bits; @@ -201,7 +201,7 @@ void inflate_fast(z_streamp strm, unsigned start) break; } from = window - OFF; - if (write == 0) { /* very common case */ + if (wnext == 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; @@ -211,17 +211,17 @@ void inflate_fast(z_streamp strm, unsigned start) from = out - dist; /* rest from output */ } } - else if (write < op) { /* wrap around window */ - from += wsize + write - op; - op -= write; + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; if (op < len) { /* some from end of window */ len -= op; do { PUP(out) = PUP(from); } while (--op); from = window - OFF; - if (write < len) { /* some from start of window */ - op = write; + if (wnext < len) { /* some from start of window */ + op = wnext; len -= op; do { PUP(out) = PUP(from); @@ -231,7 +231,7 @@ void inflate_fast(z_streamp strm, unsigned start) } } else { /* contiguous in window */ - from += write - op; + from += wnext - op; if (op < len) { /* some from window */ len -= op; do { @@ -343,7 +343,7 @@ void inflate_fast(z_streamp strm, unsigned start) inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - Using bit fields for code structure - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and write == 0 + - Three separate decoding do-loops for direct, window, and wnext == 0 - Special case for distance > 1 copies to do overlapped load and store copy - Explicit branch predictions (based on measured branch probabilities) - Deferring match copy and interspersed it with decoding subsequent codes diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index 8f767b7b9d2d..79c9e991aa33 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -21,7 +21,7 @@ int ZEXPORT inflateReset(z_streamp strm) state->head = Z_NULL; state->wsize = 0; state->whave = 0; - state->write = 0; + state->wnext = 0; state->hold = 0; state->bits = 0; state->lencode = state->distcode = state->next = state->codes; @@ -115,7 +115,7 @@ local int updatewindow(z_streamp strm, unsigned out) /* if window not in use yet, initialize */ if (state->wsize == 0) { state->wsize = 1U << state->wbits; - state->write = 0; + state->wnext = 0; state->whave = 0; } @@ -123,22 +123,22 @@ local int updatewindow(z_streamp strm, unsigned out) copy = out - strm->avail_out; if (copy >= state->wsize) { zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); - state->write = 0; + state->wnext = 0; state->whave = state->wsize; } else { - dist = state->wsize - state->write; + dist = state->wsize - state->wnext; if (dist > copy) dist = copy; - zmemcpy(state->window + state->write, strm->next_out - copy, dist); + zmemcpy(state->window + state->wnext, strm->next_out - copy, dist); copy -= dist; if (copy) { zmemcpy(state->window, strm->next_out - copy, copy); - state->write = copy; + state->wnext = copy; state->whave = state->wsize; } else { - state->write += dist; - if (state->write == state->wsize) state->write = 0; + state->wnext += dist; + if (state->wnext == state->wsize) state->wnext = 0; if (state->whave < state->wsize) state->whave += dist; } } @@ -823,12 +823,12 @@ int ZEXPORT inflate(z_streamp strm, int flush) copy = out - left; if (state->offset > copy) { /* copy from window */ copy = state->offset - copy; - if (copy > state->write) { - copy -= state->write; + if (copy > state->wnext) { + copy -= state->wnext; from = state->window + (state->wsize - copy); } else - from = state->window + (state->write - copy); + from = state->window + (state->wnext - copy); if (copy > state->length) copy = state->length; } else { /* copy from output */ diff --git a/lib/zlib/inflate.h b/lib/zlib/inflate.h index 07bd3e78a7c7..2657d611cda3 100644 --- a/lib/zlib/inflate.h +++ b/lib/zlib/inflate.h @@ -88,7 +88,7 @@ struct inflate_state { unsigned wbits; /* log base 2 of requested window size */ unsigned wsize; /* window size or zero if not using window */ unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ + unsigned wnext; /* window write index */ unsigned char FAR *window; /* allocated sliding window, if needed */ /* bit accumulator */ unsigned long hold; /* input bit accumulator */ From patchwork Wed Mar 27 14:14:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1916799 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=yBYjqRpC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V4TGg5Bdkz1yWv for ; Thu, 28 Mar 2024 01:15:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 163A58803A; Wed, 27 Mar 2024 15:15:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="yBYjqRpC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8C5F3879F6; Wed, 27 Mar 2024 15:15:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2415::601]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7B906880B9 for ; Wed, 27 Mar 2024 15:15:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E2231bG0uSsGnh3Yjtry0P55sHv9FQ4MEEGktX207Ty/DI/lhNReFx4U8qtZnysOiF+1q1sKmmtbZnHPHz8MFdioYioTLeqi0pNVBslEeoFzwR4G1UFImSgdlthRgW1aw5eXlTiUmAQBF1gPhZE73dreyxoPeCeV3x0jiRDtnjPzX+jntnMJs6kKrAiEJ4Fd5IX2zLEPuc8Brm/MPzW+/PTjDvg/ICeNfc0sByZdfkzzMWpECNzBQVzIA/4C0Vdd/9G4/0XmKbzGeu4+s9T0nQkXLF+FRJz21er35zsHuBgYPkX454AD4NNQZ0Q5SR257JhQIYtYFzwsFeJAxE8R/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9xyyMfMTcJQgcQtPej4L/1Lf9WvcKWUL9Hvc/P5ZRH4=; b=I/q8SZfK5Sq5Zj01kJtvq9gVJEPkDLqd0wxR7MiI5fkVmYV4tim8MXt3HH9r+8xMGYmow6s4MzgyiQpO05W0lwmivXDQUKeJ+4wma79SVcb4kF0aQVtCx08HPo0FFEL/syZr1rhbGQ3eeer/BgFTmwcp6KmSw6aQmTlkBkIiexMLWd8+tYySxK4vo9rlJ3i2Q/TW1Zu0WeUI3iISPwOrEcptmEfcDVfBrFyFvgxZjgC1xY75CkEzVPA02u/MWdQwFP7rNfL67XmbkL2i70LWDJ9gInJkDrHO7lORoXtriVS1YIEvYzNbIWX0kYoDh4kxBi1uQ15Zy7/GIzAVs7hYoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9xyyMfMTcJQgcQtPej4L/1Lf9WvcKWUL9Hvc/P5ZRH4=; b=yBYjqRpCb5GTLYRF9SaFHjmcdQ8peuh0Q3RENY/BMxdSHRnWotFDFiZcqRB8IlAIvV2Aw4ivif+WaVp+iqt/ajtsUACCCj+Ximc6qSuK3JJ8Nl50s7a75X9CYCqPyB5jE8azMB3ixBQSNGZB00ikKtJ2P+/x45cZRTs3W8bha8g= Received: from BL1P221CA0028.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::18) by SJ2PR12MB8690.namprd12.prod.outlook.com (2603:10b6:a03:540::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Wed, 27 Mar 2024 14:15:10 +0000 Received: from BL6PEPF0001AB4E.namprd04.prod.outlook.com (2603:10b6:208:2c5:cafe::2e) by BL1P221CA0028.outlook.office365.com (2603:10b6:208:2c5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Wed, 27 Mar 2024 14:15:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB4E.mail.protection.outlook.com (10.167.242.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Wed, 27 Mar 2024 14:15:09 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 27 Mar 2024 09:15:08 -0500 From: Michal Simek To: , CC: Tom Rini Subject: [PATCH 3/4] zlib: Port fix for CVE-2016-9841 to U-Boot Date: Wed, 27 Mar 2024 15:14:52 +0100 Message-ID: X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=12224; i=michal.simek@amd.com; h=from:subject:message-id; bh=frUFg9rGCqA/FP/ncVrYuVQ1lAnsmdxT41R8TlMkxT4=; b=owGbwMvMwCR4yjP1tKYXjyLjabUkhjQWzfsn+1zSj/je10rdF7FY5G8SQ5+Wm3O0i/72ZbumL mU5ki7YEcvCIMjEICumyCJtc+XM3soZU4QvHpaDmcPKBDKEgYtTACZy+yXDPNWlqUeifE/wd89c qnHyXs2l+Sv7DzPMr+jbV+6n+uO50/QJZk/TxcLMvryMBgA= X-Developer-Key: i=michal.simek@amd.com; a=openpgp; fpr=67350C9BF5CCEE9B5364356A377C7F21FE3D1F91 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4E:EE_|SJ2PR12MB8690:EE_ X-MS-Office365-Filtering-Correlation-Id: 9021fcef-6c29-4fbb-b552-08dc4e684f7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HrUNIJVxOYAx71a1MdYAvQ+tQdpinhjTUNNV3Pdo5wz9cqCOOHuR3m6LtRs/upYpu26zf7YCF5qySXxSGWqj7Xjr/upiFMK2qaENcEdn6csOJ95KOAwowiwlLj3yi1tqeqPUegV/uqRHy506InFhVff0zP3kaaMDHLafTu0ZPGjoqXf3nOH/EcFUER1llrazqL608YzBE8w5qkDQmYawITB2QqZGUca0CERm1G8s7dQ+8Izn3bEKNoqELcWcgoPHgxfCZeE7tB73nRSJ+EJzD6CHlbwvkCYinDiAd9+fkcnWyhUpg1VEpzmldluvz2ntE225usOtrek6KML23D+xT/TV3ja15EMUdmXb9kehjgoIZCM8CziGQAQfvjxWfFC8tFwmBUDlt14wCGZI5MTlUoMBOglWuSzBlrjKcSwEt53iXG3MdTVj8HL8JvqHSB+FR9m7yKQab3geTwQqmXn8rY15QIBB9qu2L0bKRgpCGPaD334CYUzbf0ty/L1R7Fh9kLq13+kcCMJyStP/VywFsnVilm9qjseRz7JXUTld+/1q8pRzSiVxcdX+wSZb6y6RTdLZmd0zgrJkenLUVaKc6gTe7AnB55GpF1r5qDCv0cRMqFH6hkZIaowzW4sUDcmibWTA3IQy+7/G/WbaNmcgiYdqSlt25jWIm08C4ApYJz1ImenDmhUcJTKvdQ1M+iQMmpJTHNhsvoht9VPPtLPOBw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(376005)(82310400014)(36860700004)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 14:15:09.6371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9021fcef-6c29-4fbb-b552-08dc4e684f7b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB4E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8690 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The patch corresponds to zlib commit at https://github.com/madler/zlib/commit/9aaec95e82117c1cb0f9624264c3618fc380cecb which declares that it is fixing CVE-2016-9841. Here is c&p description from zlib: "Use post-increment only in inffast.c. An old inffast.c optimization turns out to not be optimal anymore with modern compilers, and furthermore was not compliant with the C standard, for which decrementing a pointer before its allocated memory is undefined. Per the recommendation of a security audit of the zlib code by Trail of Bits and TrustInSoft, in support of the Mozilla Foundation, this "optimization" was removed, in order to avoid the possibility of undefined behavior." Origin patch also updates the code when INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR is present but this code is not the part of U-Boot hence it is ignored. Also do not deal with state->sane variable which requires other changes which are also not the part of zlib. Commit 92faa8b10918 ("zlib: handle overflow while calculating available stream input size") is kept in inffast.c too not to break described case. Signed-off-by: Michal Simek --- The first attempt to fix this is here. https://patchwork.ozlabs.org/project/uboot/patch/20220911084637.21513-1-jit.loon.lim@intel.com/ --- lib/zlib/inffast.c | 130 +++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 88 deletions(-) diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c index bdaa6d0dc51f..5e2a65ad4d27 100644 --- a/lib/zlib/inffast.c +++ b/lib/zlib/inffast.c @@ -1,5 +1,5 @@ /* inffast.c -- fast decoding - * Copyright (C) 1995-2004 Mark Adler + * Copyright (C) 1995-2008, 2010, 2013 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -12,25 +12,6 @@ #ifndef ASMINF -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is @@ -66,12 +47,13 @@ requires strm->avail_out >= 258 for each loop to avoid checking for output space. */ -void inflate_fast(z_streamp strm, unsigned start) -/* start: inflate()'s starting value for strm->avail_out */ +void ZLIB_INTERNAL inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ { struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ + z_const unsigned char FAR *in; /* local strm->next_in */ + z_const unsigned char FAR *last; /* have enough input while in < last */ unsigned char FAR *out; /* local strm->next_out */ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ unsigned char FAR *end; /* while out < end, enough space available */ @@ -97,7 +79,7 @@ void inflate_fast(z_streamp strm, unsigned start) /* copy state to local variables */ state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; + in = strm->next_in; last = in + (strm->avail_in - 5); if (in > last && strm->avail_in > 5) { /* @@ -107,7 +89,7 @@ void inflate_fast(z_streamp strm, unsigned start) strm->avail_in = 0xffffffff - (uintptr_t)in; last = in + (strm->avail_in - 5); } - out = strm->next_out - OFF; + out = strm->next_out; beg = out - (start - strm->avail_out); end = out + (strm->avail_out - 257); #ifdef INFLATE_STRICT @@ -128,9 +110,9 @@ void inflate_fast(z_streamp strm, unsigned start) input data or output space */ do { if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } here = lcode[hold & lmask]; @@ -143,14 +125,14 @@ void inflate_fast(z_streamp strm, unsigned start) Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", here.val)); - PUP(out) = (unsigned char)(here.val); + *out++ = (unsigned char)(here.val); } else if (op & 16) { /* length base */ len = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (op) { if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } len += (unsigned)hold & ((1U << op) - 1); @@ -159,9 +141,9 @@ void inflate_fast(z_streamp strm, unsigned start) } Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } here = dcode[hold & dmask]; @@ -174,10 +156,10 @@ void inflate_fast(z_streamp strm, unsigned start) dist = (unsigned)(here.val); op &= 15; /* number of extra bits */ if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } } @@ -196,17 +178,18 @@ void inflate_fast(z_streamp strm, unsigned start) if (dist > op) { /* see if copy from window */ op = dist - op; /* distance back in window */ if (op > whave) { - strm->msg = (char *)"invalid distance too far back"; + strm->msg = + (char *)"invalid distance too far back"; state->mode = BAD; break; } - from = window - OFF; + from = window; if (wnext == 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from window */ len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); from = out - dist; /* rest from output */ } @@ -217,14 +200,14 @@ void inflate_fast(z_streamp strm, unsigned start) if (op < len) { /* some from end of window */ len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); - from = window - OFF; + from = window; if (wnext < len) { /* some from start of window */ op = wnext; len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); from = out - dist; /* rest from output */ } @@ -235,65 +218,36 @@ void inflate_fast(z_streamp strm, unsigned start) if (op < len) { /* some from window */ len -= op; do { - PUP(out) = PUP(from); + *out++ = *from++; } while (--op); from = out - dist; /* rest from output */ } } while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); + *out++ = *from++; + *out++ = *from++; + *out++ = *from++; len -= 3; } if (len) { - PUP(out) = PUP(from); + *out++ = *from++; if (len > 1) - PUP(out) = PUP(from); + *out++ = *from++; } } else { - unsigned short *sout; - unsigned long loops; - from = out - dist; /* copy direct from output */ - /* minimum length is three */ - /* Align out addr */ - if (!((long)(out - 1 + OFF) & 1)) { - PUP(out) = PUP(from); - len--; - } - sout = (unsigned short *)(out - OFF); - if (dist > 2 ) { - unsigned short *sfrom; - - sfrom = (unsigned short *)(from - OFF); - loops = len >> 1; - do - PUP(sout) = get_unaligned(++sfrom); - while (--loops); - out = (unsigned char *)sout + OFF; - from = (unsigned char *)sfrom + OFF; - } else { /* dist == 1 or dist == 2 */ - unsigned short pat16; - - pat16 = *(sout-2+2*OFF); - if (dist == 1) -#if defined(__BIG_ENDIAN) - pat16 = (pat16 & 0xff) | ((pat16 & 0xff ) << 8); -#elif defined(__LITTLE_ENDIAN) - pat16 = (pat16 & 0xff00) | ((pat16 & 0xff00 ) >> 8); -#else -#error __BIG_ENDIAN nor __LITTLE_ENDIAN is defined -#endif - loops = len >> 1; - do - PUP(sout) = pat16; - while (--loops); - out = (unsigned char *)sout + OFF; - } - if (len & 1) - PUP(out) = PUP(from); + do { /* minimum length is three */ + *out++ = *from++; + *out++ = *from++; + *out++ = *from++; + len -= 3; + } while (len > 2); + if (len) { + *out++ = *from++; + if (len > 1) + *out++ = *from++; + } } } else if ((op & 64) == 0) { /* 2nd level distance code */ @@ -329,8 +283,8 @@ void inflate_fast(z_streamp strm, unsigned start) hold &= (1U << bits) - 1; /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; + strm->next_in = in; + strm->next_out = out; strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); strm->avail_out = (unsigned)(out < end ? 257 + (end - out) : 257 - (out - end)); From patchwork Wed Mar 27 14:14:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1916800 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=QbRA0cQC; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V4TGt6Zznz1yWv for ; Thu, 28 Mar 2024 01:15:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 79169880BB; Wed, 27 Mar 2024 15:15:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="QbRA0cQC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4020C880EB; Wed, 27 Mar 2024 15:15:22 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2418::600]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 94189880B9 for ; Wed, 27 Mar 2024 15:15:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=michal.simek@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VQ8OYnmgGDQe0xA1ABKJkCDecn1tndKrr0pXiuMccghx6lIe9c288NDYQnbI8BN2x96d77jgRyjZHooOtK07q85Gt8DCQFdib/FZANJkDrikZ0mM9NasLF66+6YtCQLFdvK/19bTZ18oPnUFPNxZb0V64XiTnJNPFAU8PxbdWjpv0kISDT+OXklrgfg1ky86OW0PBU/nN6LRsHrOarMFC3nbA0sWIQfb+XXOKjZ7+6PnF/RGX9Zio1KaZC26FmGxrdY5jvQ8CdXfcRpsUP4suUX2xuOUPDk1A4bILEgftuwPkdpuh2mlVmJ9Yx3PaNcSZZDRqLcbLq15az2vPRe6RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2VABfEmQ1cxu+KiTUn1YHCFAUiiNDZEAGL4Le+gxEgs=; b=HaHVUHfa9sxKlBOg/0C+FqqiJUE46fEoOIuLnvbYoFE5guuAG8gYxBBtN50VJ8bT+DCAjK5hEQtE0FMuilfBNzfggkNDVTzLf6Y9eUxgInYkhTnnjjcmjGMhn2rZi5+uyx6Dghuf9/yvEP2NTYDeoE2gTTSGs4d9cy7xhilcN0VfT6NowbdQSju4qHk9OKrKlAjxY7KanRnF6B7f7stGk0h0k8TpvGh+LepCqYL3sDdsDgJ0SrHSZmfrM9XBVZT193KruMN08TeCFGC0F6uW3L0FKVXxdRAU11OCrNDGSMKVDJ7SogRNRJj2nTTLaokamnj0dd6AyEnyeCU4rQ6x/g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2VABfEmQ1cxu+KiTUn1YHCFAUiiNDZEAGL4Le+gxEgs=; b=QbRA0cQCRMCSRWW4Jq6NSET93TqlCzkVXCKdQ4gQkmE+xxozmvYlfgzAgrL9bnKaGkxS4C9MEJH2NEnQyhnnA1wCES2S/x0ApY6qxv48v9AkOPPPcAh8LZ9fkvH5j0AwB3JophUSqJSDyCYJ5pn7SWJi9SmGWojrlXkpnCdU/RY= Received: from BL1P221CA0006.NAMP221.PROD.OUTLOOK.COM (2603:10b6:208:2c5::22) by DM6PR12MB4154.namprd12.prod.outlook.com (2603:10b6:5:21d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Wed, 27 Mar 2024 14:15:14 +0000 Received: from BL6PEPF0001AB4E.namprd04.prod.outlook.com (2603:10b6:208:2c5:cafe::89) by BL1P221CA0006.outlook.office365.com (2603:10b6:208:2c5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Wed, 27 Mar 2024 14:15:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB4E.mail.protection.outlook.com (10.167.242.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Wed, 27 Mar 2024 14:15:13 +0000 Received: from localhost (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 27 Mar 2024 09:15:12 -0500 From: Michal Simek To: , CC: Oleksandr Suvorov , Simon Glass , Tom Rini Subject: [PATCH 4/4] zlib: Remove incorrect ZLIB_VERSION Date: Wed, 27 Mar 2024 15:14:53 +0100 Message-ID: <5fd7c5b4c0b7d15e42cc9fbc69666853ee27eb0a.1711548887.git.michal.simek@amd.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=8155; i=michal.simek@amd.com; h=from:subject:message-id; bh=7OMIRWctZ6NvYHiquJvE2zUxV7g8Si3Z4GlZk66pNeA=; b=owGbwMvMwCR4yjP1tKYXjyLjabUkhjQWzQd7+wqZT1o1S+UGp044/DGq1UD9soarlqLmAX3ND +6mL553xLIwCDIxyIopskjbXDmzt3LGFOGLh+Vg5rAygQxh4OIUgIlcD2aYzbq2ddG0Jae/3p01 rS/z6bQ09gvmKxnmO4vVqLzOWXP6xNdNyvulpt6yKPBxAgA= X-Developer-Key: i=michal.simek@amd.com; a=openpgp; fpr=67350C9BF5CCEE9B5364356A377C7F21FE3D1F91 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4E:EE_|DM6PR12MB4154:EE_ X-MS-Office365-Filtering-Correlation-Id: e7ac447f-bc27-4c32-8661-08dc4e6851d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I8q6PMBf5XMJwnEdlsXBmQO25TIfWBWCpG+eznz+ZtpSl3iXmZ8iCZVb/sA0sq9YL6T/RAATuVVRX1CwOFZdFPvNoddpvGJ3HDWYpG+Yn0PobhlBep3izRt35pdtzZugX5kxJKI9bOlkI87nOS0UDKw0Bo0Y7OzoWB2XgFmLCxUv0miLYjh06axF5BiGO2vgT0VP0TvCDGpXggJlQnj9nxShxkrlTfslA6pmv5wHj9CnsM2Zv9nE0tkCPTIDsIJzKnOrX/qyFtReDxWNY+T04eHb1FqmVSAzJj81SYP2QopJw1tkW4TX5Bqy2vRD7eOFfjqWG2noSg7Fx0DDFDeQf9t+XqTx8G7TcRLSoC0hIeGRL8ocCB0gapCCkAcux491WAuYULt3YxDGwLJP+Mb415RZ2nfXn4sNBvM+LcN8xA7yAdUneTu7GG+sZhoDNwxeHGeVVjJbksw/ioQ40+VBVjxKv16V5uFjeeeOwN5WNLuG0Yr2eHMy3cW7jUglMpGRqK3fMc2/ZmWu4k1M3EacocY4SPvj+DeI1yhiAckKSDz6V4OIib/vaNrqsbDckDFHFYZ1HcHzCSEoN3hMq9KbKWorNARA2Xk7qUhLivZIm302WbOL4MH+CNJU02ohriH126VhnZnyIpA0sOKmWP/X3SMHPLRB4weiPZ+1+QP5o1wGceW8dV/qL2+DZeNJ137xDGfGXm4R5AhVGU//UzUt1A== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(36860700004)(376005)(82310400014)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2024 14:15:13.5746 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7ac447f-bc27-4c32-8661-08dc4e6851d4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB4E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4154 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Get rid of zlib version which is not correct because of U-Boot related changes and various CVE backports. The change in inspired by Linux kernel commit 4f3865fb57a0 ("[PATCH] zlib_inflate: Upgrade library code to a recent version") which described ZLIB_VERSION removal as "This patch also removes ZLIB_VERSION as it no longer has a correct value. We don't need version checks anyway as the kernel's module handling will take care of that for us. This removal is also more in keeping with the zlib author's wishes (http://www.zlib.net/zlib_faq.html#faq24) and I've added something to the zlib.h header to note its a modified version." Author describes wish to follow this guidance at https://www.zlib.net/zlib_faq.html#faq24: "The license says that altered source versions must be "plainly marked". So what exactly do I need to do to meet that requirement? You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In particular, the final version number needs to be changed to f, and an identification string should be appended to ZLIB_VERSION. Version numbers x.x.x.f are reserved for modifications to zlib by others than the zlib maintainers. For example, if the version of the base zlib you are altering is 1.2.3.4, then in zlib.h you should change ZLIB_VERNUM to 0x123f, and ZLIB_VERSION to something like 1.2.3.f-zachary-mods-v3. You can also update the version strings in deflate.c and inftrees.c." But U-Boot is not exact version that's why following the same style which has been used by Linux kernel where ZLIB_VERSION is completely removed. Signed-off-by: Michal Simek --- --- include/u-boot/zlib.h | 16 ++++++---------- lib/gzip.c | 2 +- lib/zlib/deflate.c | 13 +++---------- lib/zlib/inflate.c | 9 +++------ lib/zlib/zutil.c | 1 - 5 files changed, 13 insertions(+), 28 deletions(-) diff --git a/include/u-boot/zlib.h b/include/u-boot/zlib.h index a33cc8780d33..ee19f4609588 100644 --- a/include/u-boot/zlib.h +++ b/include/u-boot/zlib.h @@ -49,9 +49,6 @@ extern "C" { #endif -#define ZLIB_VERSION "1.2.3" -#define ZLIB_VERNUM 0x1230 - /* #include "zconf.h" */ /* included directly here */ /* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2005 Jean-loup Gailly. @@ -484,7 +481,6 @@ typedef gz_header FAR *gz_headerp; #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative * values are errors, positive values are used for special but normal events. */ @@ -523,11 +519,11 @@ typedef gz_header FAR *gz_headerp; ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); + int stream_size)); ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, - int strategy, const char *version, + int strategy, int stream_size)); ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, @@ -553,7 +549,7 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); + int stream_size)); ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input @@ -743,11 +739,11 @@ ZEXTERN int ZEXPORT uncompress2 OF((Bytef *dest, uLongf *destLen, */ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); + int stream_size)); #define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) + inflateInit_((strm), sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) + inflateInit2_((strm), (windowBits), sizeof(z_stream)) #if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; /* hack for buggy compilers */ diff --git a/lib/gzip.c b/lib/gzip.c index 5d9c19598d5e..a9a3df524de1 100644 --- a/lib/gzip.c +++ b/lib/gzip.c @@ -67,7 +67,7 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src, r = deflateInit2_(&s, Z_BEST_SPEED, Z_DEFLATED, window, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, - ZLIB_VERSION, sizeof(z_stream)); + sizeof(z_stream)); if (r != Z_OK) { printf ("Error: deflateInit2_() returned %d\n", r); return -1; diff --git a/lib/zlib/deflate.c b/lib/zlib/deflate.c index 4549f4dc12a0..7e1ed4f9b20a 100644 --- a/lib/zlib/deflate.c +++ b/lib/zlib/deflate.c @@ -196,37 +196,30 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) +int ZEXPORT deflateInit_(strm, level, stream_size) z_streamp strm; int level; - const char *version; int stream_size; { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); + Z_DEFAULT_STRATEGY, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) + stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; - const char *version; int stream_size; { deflate_state *s; int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index 79c9e991aa33..f7e81fc8b2a0 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -30,14 +30,11 @@ int ZEXPORT inflateReset(z_streamp strm) return Z_OK; } -int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, +int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, int stream_size) { struct inflate_state FAR *state; - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; /* in case we return an error */ if (strm->zalloc == (alloc_func)0) { @@ -70,9 +67,9 @@ int ZEXPORT inflateInit2_(z_streamp strm, int windowBits, const char *version, return inflateReset(strm); } -int ZEXPORT inflateInit_(z_streamp strm, const char *version, int stream_size) +int ZEXPORT inflateInit_(z_streamp strm, int stream_size) { - return inflateInit2_(strm, DEF_WBITS, version, stream_size); + return inflateInit2_(strm, DEF_WBITS, stream_size); } local void fixedtables(struct inflate_state FAR *state) diff --git a/lib/zlib/zutil.c b/lib/zlib/zutil.c index 609aac55ce11..ec21b458fcce 100644 --- a/lib/zlib/zutil.c +++ b/lib/zlib/zutil.c @@ -21,7 +21,6 @@ const char * const z_errmsg[10] = { "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; #ifdef DEBUG