From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Nick Terrell <terrelln@fb.com>
Cc: "Jonathan Neuschäfer" <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 [thread overview]
Message-ID: <20230129131436.1343228-1-j.neuschaefer@gmx.net> (raw)
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(-)
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
next reply other threads:[~2023-01-29 13:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-29 13:14 Jonathan Neuschäfer [this message]
2023-03-03 6:30 ` [PATCH] zstd: Fix definition of assert() Nick Terrell
2023-03-03 6:51 ` Nick Terrell
2023-03-03 14:27 ` Jonathan Neuschäfer
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=20230129131436.1343228-1-j.neuschaefer@gmx.net \
--to=j.neuschaefer@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=terrelln@fb.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.