Message ID | 20230129131436.1343228-1-j.neuschaefer@gmx.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1746223wrn; Sun, 29 Jan 2023 05:36:04 -0800 (PST) X-Google-Smtp-Source: AK7set8g6Ejzujpa+cvdo5q6eXwoiI0YFAFMqF7c7AZkeKdE4U90zeQuYxCigStyq6IILB1E8dCM X-Received: by 2002:a17:90a:1952:b0:22c:3edd:7e48 with SMTP id 18-20020a17090a195200b0022c3edd7e48mr10954267pjh.32.1674999363646; Sun, 29 Jan 2023 05:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674999363; cv=none; d=google.com; s=arc-20160816; b=MslZyJc1beiYW/fYxj13a12dplPURPVboHaepBNZZgXskW9TWXAgVXMwlZATqYdsVz PhlZF++9iPSNGAITK87bCAqT6qxcBZRxMGtgyYBPhfxffiQQBo5Z0xI2+dTAD18se+xH C6sfsZrkLD1lio4YT6HWft6mkIhpBfmQpbFy0tyJnXkbi9Lt1fMw7rmwAKzuKyXd2lJc rIoB3ceVPwSxkZ2+9MJ6Ut3RsIskJl/i/mP8sietkjNhnS5fBZ0v9vYCQHO+qQA12Ey7 aRJIlN6Brx9FfBpl4+el3iWtp8e1KIMzAuRR01c1T0o7Cj3kl3UevuFM7w6D0Gi3LXbJ KAMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=/14ZPfJMabfXZtz/YCRdcrIUN5mBNRyQkPceGaXBkCQ=; b=d+JqiCCcK0c5G32E8m0IE8oxbcHzSc45nqUK8Pm5eZknIwxXfDVfSsgT9gQPiaDXm0 sO1kWMOYrBjA+bDTNNlf7hXjS48UJD1F7gyRGHvudTqMJnA4ters4f3HAzEzvJhKsThH 0puYeimNGro1qy7CAR7CXaCld+ZwrTQ+QRvgiT96si9rgC/7uXkHFFQxji6KA1OJkx7U lXFUUeq9Mrc+K3qMT9h8sjb9MBxly3fkapfGYST/R2FFlSMiFFrCMBk58e0C2HgQ39Lt z0OJ338XYIRLeg+HCWQs48m03WtGI4WMPpi+kgkV4om36+xIhINkBoVDU+x59erZTOXN 344w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=s31663417 header.b=Ktv3waJM; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 28-20020a17090a031c00b0022c05520917si13722509pje.28.2023.01.29.05.35.50; Sun, 29 Jan 2023 05:36:03 -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=@gmx.net header.s=s31663417 header.b=Ktv3waJM; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmx.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234952AbjA2NOv (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Sun, 29 Jan 2023 08:14:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbjA2NOu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 29 Jan 2023 08:14:50 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 626E6BBB9 for <linux-kernel@vger.kernel.org>; Sun, 29 Jan 2023 05:14:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1674998083; bh=/14ZPfJMabfXZtz/YCRdcrIUN5mBNRyQkPceGaXBkCQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=Ktv3waJMgdQlz7+K8gZQxatfsvumn6AFRCfOTfTXY6173i39NtX6HtUswdoaM/rVd dky3PCMSSqyy0Y5vILge/suqXyWJdi08B5sSiCtxGQZA/7yV7w6S6av4wLCXruCHk+ 4N9NwosGe5VBaEtl9G2010jvSZp3mU6DRJboQC+FrNKLbNQZauWhNyYfkH4anUxO3L hLUIRzF7N5DpOoELxLiXsq5ckZzW5W0xe/I8SR31yYnFP2oo2uKzvndcriALqQJOAH NqNVZpBarIkp/9Tr5qWt96JmqBxapUGMwL1gb33Jilh62ufvxgHQRGX6dZB1gB0wsc gIlZ8UjVFoDOg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from probook ([95.223.44.193]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N2Dx8-1oeisf2SEg-013aRf; Sun, 29 Jan 2023 14:14:43 +0100 From: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= <j.neuschaefer@gmx.net> To: Nick Terrell <terrelln@fb.com> Cc: =?utf-8?q?Jonathan_Neusch=C3=A4fer?= <j.neuschaefer@gmx.net>, linux-kernel@vger.kernel.org Subject: [PATCH] zstd: Fix definition of assert() Date: Sun, 29 Jan 2023 14:14:36 +0100 Message-Id: <20230129131436.1343228-1-j.neuschaefer@gmx.net> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:/ZAhSq3caiLIgUhjFdsZBwOlh3xV1QguoIGzAM0QAzQfm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KjNqndGJrirGp+5udiZzpOQKIJx5bKIincoroER HJsrxEeGeAnxZSA7IsviCEK7aTMFvknqKOsApSebpRouRzDUrb1xeFYKwfb91XzTiwzLC6ExM wSyo+ZJVBNq3Ks7DSQk0PGW99mk= X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756364132988456857?= X-GMAIL-MSGID: =?utf-8?q?1756364132988456857?= |
Series |
zstd: Fix definition of assert()
|
|
Commit Message
Jonathan Neuschäfer
Jan. 29, 2023, 1:14 p.m. UTC
assert(x) should emit a warning if x is false. WARN_ON(x) emits a
warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x)
rather than WARN_ON(x).
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
---
Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd
version 1.4.10") mentions that the zstd code was generated from the
upstream version of zstd, so perhaps the definition of assert based on
WARN_ON should be fixed in the conversion script and/or upstream zstd
source code.
---
lib/zstd/common/zstd_deps.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.39.0
Comments
> On Jan 29, 2023, at 5:14 AM, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote: > > !-------------------------------------------------------------------| > This Message Is From an External Sender > > |-------------------------------------------------------------------! > > assert(x) should emit a warning if x is false. WARN_ON(x) emits a > warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x) > rather than WARN_ON(x). > > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Hi Jonathan, I have to apologize, I just submitted my branch for a PR and I realize that while I intended to take your patch, I took a different equivalent patch. So I wanted to say thanks for sending the patch! > --- > > Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd > version 1.4.10") mentions that the zstd code was generated from the > upstream version of zstd, so perhaps the definition of assert based on > WARN_ON should be fixed in the conversion script and/or upstream zstd > source code. Yeah, we need to fix it upstream, so if you would like to submit the upstream PR the file is contrib/linux-kernel/zstd_deps.h [0]. Otherwise, I will update it before the next import. Best, Nick Terrell [0] https://github.com/facebook/zstd/blob/dev/contrib/linux-kernel/zstd_deps.h > --- > lib/zstd/common/zstd_deps.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/zstd/common/zstd_deps.h b/lib/zstd/common/zstd_deps.h > index 7a5bf44839c9c..f06df065dec01 100644 > --- a/lib/zstd/common/zstd_deps.h > +++ b/lib/zstd/common/zstd_deps.h > @@ -84,7 +84,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) { > > #include <linux/kernel.h> > > -#define assert(x) WARN_ON((x)) > +#define assert(x) WARN_ON(!(x)) > > #endif /* ZSTD_DEPS_ASSERT */ > #endif /* ZSTD_DEPS_NEED_ASSERT */ > -- > 2.39.0 >
On Fri, Mar 03, 2023 at 06:30:47AM +0000, Nick Terrell wrote: > On Jan 29, 2023, at 5:14 AM, Jonathan Neuschäfer <j.neuschaefer@gmx.net> wrote: > > > > assert(x) should emit a warning if x is false. WARN_ON(x) emits a > > warning if x is true. Thus, assert(x) should be defined as WARN_ON(!x) > > rather than WARN_ON(x). > > > > Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> > > Hi Jonathan, > > I have to apologize, I just submitted my branch for a PR and I realize that > while I intended to take your patch, I took a different equivalent patch. So > I wanted to say thanks for sending the patch! No problem at all, and thanks for informing me! > > > --- > > > > Commit e0c1b49f5b674 ("lib: zstd: Upgrade to latest upstream zstd > > version 1.4.10") mentions that the zstd code was generated from the > > upstream version of zstd, so perhaps the definition of assert based on > > WARN_ON should be fixed in the conversion script and/or upstream zstd > > source code. > > Yeah, we need to fix it upstream, so if you would like to submit the upstream PR > the file is contrib/linux-kernel/zstd_deps.h [0]. Otherwise, I will update it before > the next import. Feel free to do it yourself, as I haven't been involed with zstd developement so far. Thanks, Jonathan
diff --git a/lib/zstd/common/zstd_deps.h b/lib/zstd/common/zstd_deps.h index 7a5bf44839c9c..f06df065dec01 100644 --- a/lib/zstd/common/zstd_deps.h +++ b/lib/zstd/common/zstd_deps.h @@ -84,7 +84,7 @@ static uint64_t ZSTD_div64(uint64_t dividend, uint32_t divisor) { #include <linux/kernel.h> -#define assert(x) WARN_ON((x)) +#define assert(x) WARN_ON(!(x)) #endif /* ZSTD_DEPS_ASSERT */ #endif /* ZSTD_DEPS_NEED_ASSERT */