From patchwork Thu Jan 26 13:14:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zaslonko Mikhail X-Patchwork-Id: 48630 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp264641wrn; Thu, 26 Jan 2023 05:17:17 -0800 (PST) X-Google-Smtp-Source: AK7set//PF386c4VzQf5xGmZmCRF9W80vwEfnT9XxYecgT6TBWbEkxuwFGdh2yLpoZ8vVP9YaKbX X-Received: by 2002:aa7:dd16:0:b0:4a0:a767:6138 with SMTP id i22-20020aa7dd16000000b004a0a7676138mr7250009edv.22.1674739037791; Thu, 26 Jan 2023 05:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674739037; cv=none; d=google.com; s=arc-20160816; b=Dvj6EgM1WBsOh44DJsFWeHQt0O9SeEx1m6gVQ4s9P9GtR9+qhChbNo2onaFqskb55+ 4QhWGmIK3qzmpxV7rDweeE1+65TopTpQfqA/7oQXnEhuIFooRH0CGO+LkHNJOai2fTlS aSLxBE+mUH27A0qqvAXHJEfb/9A0uJYEKs6NEyl9vFuG2OcrOs/j93gTOfflTxRoIyoh lVu4AxqrwGoTXBrVFs66DkfRw21SEGjYSLJ1L1afE2T3MDC5BzxEDM2HqrvIOwTQYtsT B5Bph6RjuH9zANegNXx8pGQoxHNi7FsSUGRykreY6ljghzK6O866XqPiDX14OZ9R2FRg PnCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xZnK30byH773TSlmzCY8FkqJLqxkE35ZGt5rDfbB3AQ=; b=UWmzTEq1pdsXJL1uRJnefzMFHRsvWFPxHxdyXdXBDdarwCP1F+0zZkUZ2ekQqVmeru fkPTJgWqTXHI3e93kyJY3dT1xj1nMg3gXZ5+L/rJHwmMR6HS9Oj7PxmUJ7kqafQOu0P9 JboLiQrIirogg4VdYEdkUVBs9sHjvjSXG/BUsyu2r4hzOOHBA9lOZZXBoGgDqaOMmhry p3+elM/KN7JoPWUbUn+eZzQs2BqCRzl0/8wYc4TuQ/D0XD32lxqGMvD8YRFRTupPfIAy 66bRzeyBrDLp8tBTymVEVLw9ANEq/xDVdA9RQ3PKpRGCFaeSHGES99e38IvHBcYF0zND mU+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sjZgNM8g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j1-20020a170906104100b008779b708a5bsi1408178ejj.288.2023.01.26.05.16.53; Thu, 26 Jan 2023 05:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=sjZgNM8g; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236740AbjAZNP3 (ORCPT + 99 others); Thu, 26 Jan 2023 08:15:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236635AbjAZNOx (ORCPT ); Thu, 26 Jan 2023 08:14:53 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6085569515 for ; Thu, 26 Jan 2023 05:14:37 -0800 (PST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30QCvE8o024932; Thu, 26 Jan 2023 13:14:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=xZnK30byH773TSlmzCY8FkqJLqxkE35ZGt5rDfbB3AQ=; b=sjZgNM8gGykl6+aE/qeCiuyijmbNc0q6rOkgQLJxU2Ju7E6Gruz3NWZgFOMFVndwwUb8 nQJdFd3XAaMKXA8YeTmQ7BEYVHumnRN6OVaF9HwiQ+HvoS93s8aKI0hI7Q+JNBV8kWDl NnxYAwKABOJwwQrqvAHPKoJ1w8l8QVoPRSsEnZpSBsGEuz+X7CeoQDbJYiAI3uHdWazC 654+VhxB0mrUOfW9hHlK8ZRq40+b9mcTOY2dACQpmplc+wr7MZFTVp+/7Z/XNggx9IxJ Tdjis8sVU48ioO6WAqYtOdJYb1PkTe0RvSzqrai8qOw+yWZdyOJG8uz4ZSou4zr1gadW qA== Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nbsymrh0d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 13:14:36 +0000 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30QApjVV015356; Thu, 26 Jan 2023 13:14:33 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma06ams.nl.ibm.com (PPS) with ESMTPS id 3n87afeds4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 13:14:33 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30QDEUia47251910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 13:14:30 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 270F920040; Thu, 26 Jan 2023 13:14:30 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E7B512004B; Thu, 26 Jan 2023 13:14:29 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 26 Jan 2023 13:14:29 +0000 (GMT) From: Mikhail Zaslonko To: Andrew Morton Cc: LKML , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Mikhail Zaslonko Subject: [PATCH 3/8] lib/zlib: Fix DFLTCC not flushing EOBS when creating raw streams Date: Thu, 26 Jan 2023 14:14:23 +0100 Message-Id: <20230126131428.1222214-4-zaslonko@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126131428.1222214-1-zaslonko@linux.ibm.com> References: <20230126131428.1222214-1-zaslonko@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KLd4gjgFqewnrScAbuH9bAGRAo3XtEgo X-Proofpoint-ORIG-GUID: KLd4gjgFqewnrScAbuH9bAGRAo3XtEgo X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-26_05,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 bulkscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=758 spamscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301260126 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756091161278188965?= X-GMAIL-MSGID: =?utf-8?q?1756091161278188965?= This commit is based on: https://github.com/zlib-ng/zlib-ng/commit/ca99a88 Signed-off-by: Mikhail Zaslonko Acked-by: Ilya Leoshkevich --- lib/zlib_deflate/deflate.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/zlib_deflate/deflate.c b/lib/zlib_deflate/deflate.c index 8a878d0d892c..f30d6b8a69b2 100644 --- a/lib/zlib_deflate/deflate.c +++ b/lib/zlib_deflate/deflate.c @@ -451,17 +451,24 @@ int zlib_deflate( Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; - if (s->noheader) return Z_STREAM_END; - /* Write the zlib trailer (adler32) */ - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); + if (!s->noheader) { + /* Write zlib trailer (adler32) */ + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ - s->noheader = -1; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; + if (!s->noheader) { + s->noheader = -1; /* write the trailer only once! */ + } + if (s->pending == 0) { + Assert(s->bi_valid == 0, "bi_buf not flushed"); + return Z_STREAM_END; + } + return Z_OK; } /* ========================================================================= */