From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH 03/21] lib/zlib: update deflate to zlib 1.2.0 release
Date: Thu, 03 Dec 2026 08:29:43 +0100 [thread overview]
Message-ID: <20261203-zlib-sync-v1-3-0d4ec56f1afb@linuxfoundation.org> (raw)
In-Reply-To: <20261203-zlib-sync-v1-0-0d4ec56f1afb@linuxfoundation.org>
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 <gregkh@linuxfoundation.org>
---
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 <linux/zconf.h>
-/* 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
next prev parent reply other threads:[~2026-12-03 7:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 7:29 [PATCH 00/21] lib/zlib: start to bring the in-kernel version in sync with upstream Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 01/21] MAINTAINERS: add myself as the zlib maintainer Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 02/21] lib/zlib: update deflate to zlib 1.1.4 release Greg Kroah-Hartman
2026-12-03 7:29 ` Greg Kroah-Hartman [this message]
2026-12-03 7:29 ` [PATCH 04/21] lib/zlib: update deflate to zlib 1.2.0.1 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 05/21] lib/zlib: update deflate to zlib 1.2.0.2 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 06/21] lib/zlib: update deflate to zlib 1.2.0.3 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 07/21] lib/zlib: update deflate to zlib 1.2.0.4 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 08/21] lib/zlib: update deflate to zlib 1.2.0.5 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 09/21] lib/zlib: update deflate to zlib 1.2.0.6 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 10/21] lib/zlib: update deflate to zlib 1.2.0.7 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 11/21] lib/zlib: update deflate to zlib 1.2.0.8 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 12/21] lib/zlib: update deflate to zlib 1.2.1 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 13/21] lib/zlib: update deflate to zlib 1.2.1.1 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 14/21] lib/zlib: update deflate to zlib 1.2.1.2 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 15/21] lib/zlib: update deflate to zlib 1.2.2 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 16/21] lib/zlib: update deflate to zlib 1.2.2.1 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 17/21] lib/zlib: catch code up to the real zlib 1.1.3 Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 18/21] lib/zlib: update deflate to zlib 1.2.2.2 release Greg Kroah-Hartman
2026-12-03 7:29 ` [PATCH 19/21] lib/zlib: update deflate to zlib 1.2.2.3 release Greg Kroah-Hartman
2026-12-03 7:30 ` [PATCH 20/21] lib/zlib: update deflate to zlib 1.2.2.4 release Greg Kroah-Hartman
2026-12-03 7:30 ` [PATCH 21/21] lib/zlib: update deflate to zlib 1.2.3 release Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203-zlib-sync-v1-3-0d4ec56f1afb@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®