]>
Commit | Line | Data |
---|---|---|
edf5051c FG |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: DeHackEd <DeHackEd@users.noreply.github.com> | |
3 | Date: Wed, 21 Feb 2018 17:54:26 -0500 | |
4 | Subject: [PATCH] Fix multiple evaluations of VERIFY() and ASSERT() on failures | |
5 | MIME-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ||
9 | Reviewed-by: loli10K <ezomori.nozomu@gmail.com> | |
10 | Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> | |
11 | Signed-off-by: DHE <git@dehacked.net> | |
12 | Closes #684 | |
13 | Closes #685 | |
14 | (cherry picked from commit 610988f2dbf0e1c5811e6115d7ff8948b90a660e) | |
15 | Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> | |
16 | --- | |
17 | include/sys/debug.h | 15 +++++++++------ | |
18 | 1 file changed, 9 insertions(+), 6 deletions(-) | |
19 | ||
20 | diff --git a/include/sys/debug.h b/include/sys/debug.h | |
21 | index 6d683c2..b523ea1 100644 | |
22 | --- a/include/sys/debug.h | |
23 | +++ b/include/sys/debug.h | |
24 | @@ -63,12 +63,15 @@ void spl_dumpstack(void); | |
25 | spl_panic(__FILE__, __FUNCTION__, __LINE__, \ | |
26 | "%s", "VERIFY(" #cond ") failed\n")) | |
27 | ||
28 | -#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) \ | |
29 | - (void) ((!((TYPE)(LEFT) OP (TYPE)(RIGHT))) && \ | |
30 | - spl_panic(__FILE__, __FUNCTION__, __LINE__, \ | |
31 | - "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ | |
32 | - "failed (" FMT " " #OP " " FMT ")\n", \ | |
33 | - CAST (LEFT), CAST (RIGHT))) | |
34 | +#define VERIFY3_IMPL(LEFT, OP, RIGHT, TYPE, FMT, CAST) do { \ | |
35 | + TYPE _verify3_left = (TYPE)(LEFT); \ | |
36 | + TYPE _verify3_right = (TYPE)(RIGHT); \ | |
37 | + if (!(_verify3_left OP _verify3_right)) \ | |
38 | + spl_panic(__FILE__, __FUNCTION__, __LINE__, \ | |
39 | + "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \ | |
40 | + "failed (" FMT " " #OP " " FMT ")\n", \ | |
41 | + CAST (_verify3_left), CAST (_verify3_right)); \ | |
42 | + } while (0) | |
43 | ||
44 | #define VERIFY3B(x,y,z) VERIFY3_IMPL(x, y, z, boolean_t, "%d", (boolean_t)) | |
45 | #define VERIFY3S(x,y,z) VERIFY3_IMPL(x, y, z, int64_t, "%lld", (long long)) | |
46 | -- | |
47 | 2.14.2 | |
48 |