From patchwork Thu Jan 26 13:14:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zaslonko Mikhail X-Patchwork-Id: 48629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp264553wrn; Thu, 26 Jan 2023 05:17:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXtkHFICR48V0fWzgWQNrh3Ckz6xiYvMpCMpEkNO8JjRx6VDkqnP+nIxVd0ZVRynvmHXnR1n X-Received: by 2002:a17:907:2392:b0:86e:c9e2:6329 with SMTP id vf18-20020a170907239200b0086ec9e26329mr34698635ejb.12.1674739027194; Thu, 26 Jan 2023 05:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674739027; cv=none; d=google.com; s=arc-20160816; b=QbijY68fpehdduTEBuREYfjxIIRutiEbblgj25R8EtL4E3o3CkKFPKSFuKn2RuJdBv mkPkDDFBtLiYBnUWWEA2GMx001J2fZRDUBaYUrgEBhvSlpx/3KG0TSrj5OdW0DjKiEaj DQWTTUqrVVqT0jzjnj6A/BBMaT7Cf5lMVlLJC+Ov6HkVripBJ92V/ss1AG1Cl5JGf6qm gM5DMfPnAouQL1pH2Ya1aQee06+uhkMasuBizeOcidzsoYiSrTLViRBVO7gtPvsY/I58 23zVqJ78agyCTuJ870BFO6hhBGf6X8LEx35BpwLLPaU7eZYQ1DA2yaNZpZzpY2pbaNSF Q6lg== 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=ZKOqHnDXJa7jRfwmB881p/x5nb/JTibiWGwBU+BYF4k=; b=e+DPdVXlbg2nqwyuynfF7wW6WueTjLWRKT4KfcZxoERPGzkAF7IzSebRpSX3dS6RQK 3vRx8XzF/ZuVOHbCMf11UngB4ujQrDRg1n+QnfrjGfoeirz2jtXePrZT72WsRenRCHsN ZyuX+oTQxAd25jtUOGx5YKO75wm0JxTgRxo2G6XabrAps+H2CXkpkDwwIQc7nbmCIY1W Wm/7QWIYa1Y8vFud/YNfO/1Mjsv4D+wlqCBrWcA46hnUNrhjzicxJNxNPwykLRP7Azv6 H3Yj5l/cueXOmKZCiUO2MG99hoHoVv2NpTemqfOnfYkiLrt8rCO1ICmYPbOVr3KdQE64 2Ukw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=FxlywZqu; 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 wc13-20020a170907124d00b008779c9c6ba1si1293232ejb.43.2023.01.26.05.16.43; Thu, 26 Jan 2023 05:17:07 -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=FxlywZqu; 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 S236729AbjAZNPZ (ORCPT + 99 others); Thu, 26 Jan 2023 08:15:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236611AbjAZNOx (ORCPT ); Thu, 26 Jan 2023 08:14:53 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9C0369507 for ; Thu, 26 Jan 2023 05:14:36 -0800 (PST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30QCkVh3000343; Thu, 26 Jan 2023 13:14:35 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=ZKOqHnDXJa7jRfwmB881p/x5nb/JTibiWGwBU+BYF4k=; b=FxlywZqu7WtBFFV0CJc4JlgYNlLcxtmlKcIVObhpfRYIqIR+SdduOgXH5NBFTsa6n95k +cYzlRVs8fRiCLPBlXGDPrEUMahNiLgEIYz35SFNRnWcz8ZEMmAMAziakd7TIOPukse3 qX0VBZw4m6KBCwdsrbw3YBbfEU9I9zgb3kEmXEpNbcsksKCHL/DLcT4eWQpnMJzgbDDT JWQVUKd9voc8CYokLWGzR9m9cGwFE3VpXhaQLgNYTakltOhKKCA1r3BH2vl/2ltCgy+A 4ABjSu1R9KiEhVM/Bsrdz0eZX0zLjaMNV3FFdqI0XJW/nRrJDiiKx3ESvGDYB1t5xGjI ZA== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nbrka2ca0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Jan 2023 13:14:35 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30Q2KLfI027371; Thu, 26 Jan 2023 13:14:33 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma04fra.de.ibm.com (PPS) with ESMTPS id 3n87p6ckhe-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 smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30QDETNT48693644 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2023 13:14:29 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9EDF820040; Thu, 26 Jan 2023 13:14:29 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 612EA2004B; 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 1/8] lib/zlib: Adjust offset calculation for dfltcc_state Date: Thu, 26 Jan 2023 14:14:21 +0100 Message-Id: <20230126131428.1222214-2-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-ORIG-GUID: 0T-ZVNQ6r_emaLyPji3ibcq_SSxr3Ms_ X-Proofpoint-GUID: 0T-ZVNQ6r_emaLyPji3ibcq_SSxr3Ms_ 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 phishscore=0 adultscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 spamscore=0 clxscore=1015 suspectscore=0 malwarescore=0 lowpriorityscore=0 mlxscore=0 mlxlogscore=700 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,RCVD_IN_MSPIKE_H2,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?1756091150387366803?= X-GMAIL-MSGID: =?utf-8?q?1756091150387366803?= This commit is based on: https://github.com/zlib-ng/zlib-ng/commit/d8b67f5 Signed-off-by: Mikhail Zaslonko Acked-by: Ilya Leoshkevich --- lib/zlib_dfltcc/dfltcc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/zlib_dfltcc/dfltcc.h b/lib/zlib_dfltcc/dfltcc.h index 2a2fac1d050a..1f63094366e9 100644 --- a/lib/zlib_dfltcc/dfltcc.h +++ b/lib/zlib_dfltcc/dfltcc.h @@ -100,8 +100,9 @@ struct dfltcc_state { char msg[64]; /* Buffer for strm->msg */ }; +#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1)) /* Resides right after inflate_state or deflate_state */ -#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((state) + 1)) +#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8))) /* External functions */ int dfltcc_can_deflate(z_streamp strm);