From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796283009; b=qvtJDCg1xDEZbzE/QkgY3FDxDyIWX0vkWmK4IRU4XYnGq9csU1I3ifndxKNN1iaFAJkr cjpKaa9m61+Wl3tq+Tv4+wWZ0/T65Zvun7FAbdTQ9G7INGToXzNpH1itaeXnCpP0p3Izy Xuw8LGiAqq9kUY37TykU155d3xBr7o0NOhyC23aujo96a7HpiZu14Gp00+jXbuvet8xKe BWZ3iSdPX+9krMFD/sFEYlPqjffwHhiXtNSNpaJHfm22Dy0RayhUjBuDr9tRxUBQqnB2+ rnCeeICu9gWGfU0lmBPaPfXJ4dunIgm4yutwfdulimT0iKWYXS4iR8+DPxA5FN3YUsA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796283009; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=s72yTlADq81LNpKUxu5X6tUcJm9sR3F+xGl/P3NV5nI=; b=Q4Gu1Nw4UfS3ziBWUDMC9RHIugIFKt/rwF5SNXMu9cHOaWVpOVZ46j8uGPzTs1GRyqol 1I8oCESx6dsE5hRJGbxv0Bs+Bi4gceBysfkriKc2TouS42+0U7I1rBc0BeiHuiAipZ/wW TXM5JO+0IdRk+XBaGXUbOcUsgd3+IAi1m+Q3wI9z7S29gwLqnGCrhe+Pmq4o3wRil5PKn h0MZR8vjowlKdj/owu+KfEYDVhejKrnW8QlGdVAFI6RSq+0+uQwQGArerpGW6HChaFbPx uqQgpgzc36WUaZKhfk2WuhFvoChedbAFVDz8LSDB/U0Ijrxi8ygxdawtr0pNE4OLNTg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wjXBIbQt; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60919606A333 for ; Thu, 3 Dec 2026 07:30:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wjXBIbQt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15DAA1F00899; Thu, 3 Dec 2026 07:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796283008; bh=s72yTlADq81LNpKUxu5X6tUcJm9sR3F+xGl/P3NV5nI=; h=From:Date:Subject:References:In-Reply-To:To; b=wjXBIbQtneQd95uHHkB9MOty4gB6ugJrv6QUInQPiLjMBzB7VoS0DgCOcbNgCZyoV OdtC6apB2oNByrzPFfOM5i4i2jyEwnB93hrOlxoAEzVhBiMGQBJhyPUBCciqCjrXDL 1YDqOHWdFCBNi1fYuVcyWEJvnbNdbAARUmDriF8Y= From: Greg Kroah-Hartman Date: Thu, 03 Dec 2026 08:29:43 +0100 Subject: [PATCH 03/21] lib/zlib: update deflate to zlib 1.2.0 release X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261203-zlib-sync-v1-3-0d4ec56f1afb@linuxfoundation.org> References: <20261203-zlib-sync-v1-0-0d4ec56f1afb@linuxfoundation.org> In-Reply-To: <20261203-zlib-sync-v1-0-0d4ec56f1afb@linuxfoundation.org> To: linux-kernel@vger.kernel.org, Greg Kroah-Hartman X-Mailer: b4 0.17-dev-73bef X-Developer-Signature: v=1; a=openpgp-sha256; l=4230; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=wikQyzcHtrkaqSK26DkIX0I1EV7yqgOdlJawFAQgnso=; b=owGbwMvMwCRo6H6F97bub03G02pJDNmCUlmd5s/F7h8pPL/MWyn76soTl27cffncWUN8N7e5S Kbm7BuqHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCR76YMCxa0XDu+ZjLru+LL G+cxyDo4vbm6hJlhnl7Fz6RNoiVxoT/bDWOuBYpHZe1xBAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Sync the kernel deflate code with the zlib 1.2.0 release. This involves: - open-code the depth comparison in build_tree() instead of using a MAX() macro (upstream removed the macro; the kernel copy used the kernel's max() here which was the same, if not better, but oh well...) - drop the check_func typedef from zutil.h; nothing has used it since the inflate code was rewritten (the kernel inflate is already based on 1.2.3 and does not use it) - comment and copyright updates There were some 1.2.0 changes that were not relevant to the kernel copy: - the deflate_copyright string and version handshake. - marking the state FINISH_STATE when allocation fails in deflateInit2 (the kernel workspace is preallocated by the caller, there is no failure path). - deflateSetDictionary() raw mode support and deflateParams(). - deflateBound(), new in 1.2.0, already exists in the kernel copy as a much simpler inline function in zlib.h using the same formula. The kernel is now in sync with zlib commit 7c2a874e50b8 ("zlib 1.2.0"). Signed-off-by: Greg Kroah-Hartman --- include/linux/zlib.h | 2 +- include/linux/zutil.h | 8 +------- lib/zlib_deflate/deflate.c | 2 +- lib/zlib_deflate/deftree.c | 7 ++++--- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/linux/zlib.h b/include/linux/zlib.h index abd3320d7c48..2e04200282d5 100644 --- a/include/linux/zlib.h +++ b/include/linux/zlib.h @@ -32,7 +32,7 @@ #include -/* zlib deflate based on ZLIB_VERSION "1.1.4" */ +/* zlib deflate based on ZLIB_VERSION "1.2.0" */ /* zlib inflate based on ZLIB_VERSION "1.2.3" */ /* diff --git a/include/linux/zutil.h b/include/linux/zutil.h index 663689521759..c77a8d43d12f 100644 --- a/include/linux/zutil.h +++ b/include/linux/zutil.h @@ -1,5 +1,5 @@ /* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-1998 Jean-loup Gailly. + * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -42,12 +42,6 @@ typedef unsigned long ulg; # define OS_CODE 0x03 /* assume Unix */ #endif - /* functions */ - -typedef uLong (*check_func) (uLong check, const Byte *buf, - uInt len); - - /* checksum functions */ #define BASE 65521L /* largest prime smaller than 65536 */ diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c index 1f5a40e8d437..2cf1e3500104 100644 --- a/lib/zlib_deflate/deflate.c +++ b/lib/zlib_deflate/deflate.c @@ -1,6 +1,6 @@ /* +++ deflate.c */ /* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2002 Jean-loup Gailly. + * Copyright (C) 1995-2003 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ diff --git a/lib/zlib_deflate/deftree.c b/lib/zlib_deflate/deftree.c index eee325ebc351..2b98e56a713f 100644 --- a/lib/zlib_deflate/deftree.c +++ b/lib/zlib_deflate/deftree.c @@ -1,6 +1,6 @@ /* +++ trees.c */ /* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2002 Jean-loup Gailly + * Copyright (C) 1995-2003 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ @@ -540,7 +540,8 @@ static void build_tree( /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch) (max(s->depth[n], s->depth[m]) + 1); + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; #ifdef DUMP_BL_TREE if (tree == s->bl_tree) { @@ -832,7 +833,7 @@ ulg zlib_tr_flush_block( */ max_blindex = build_bl_tree(s); - /* Determine the best encoding. Compute first the block length in bytes*/ + /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; -- 2.56.1