[PATCH AUTOSEL 6.2 09/45] zstd: Fix definition of assert()
From: Sasha Levin
Date: Wed Mar 22 2023 - 15:59:35 EST
From: Jonathan Neuschäfer <j.neuschaefer@xxxxxxx>
[ Upstream commit 6906598f1ce93761716d780b6e3f171e13f0f4ce ]
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@xxxxxxx>
Signed-off-by: Nick Terrell <terrelln@xxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
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.2