aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zdb/zdb.c
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-10-27 12:45:26 -0400
committerBrian Behlendorf <[email protected]>2022-10-29 13:04:52 -0700
commitd71d69326116756e69b2d7bee4582f00de27ec72 (patch)
treed683b02e89eab9cfbd24023bf54d6248a75b32a2 /cmd/zdb/zdb.c
parent4170ae4ea600fea6ac9daa8b145960c9de3915fc (diff)
Fix too few arguments to formatting function
CodeQL reported that when the VERIFY3U condition is false, we do not pass enough arguments to `spl_panic()`. This is because the format string from `snprintf()` was concatenated into the format string for `spl_panic()`, which causes us to have an unexpected format specifier. A CodeQL developer suggested fixing the macro to have a `%s` format string that takes a stringified RIGHT argument, which would fix this. However, upon inspection, the VERIFY3U check was never necessary in the first place, so we remove it in favor of just calling `snprintf()`. Lastly, it is interesting that every other static analyzer run on the codebase did not catch this, including some that made an effort to catch such things. Presumably, all of them relied on header annotations, which we have not yet done on `spl_panic()`. CodeQL apparently is able to track the flow of arguments on their way to annotated functions, which llowed it to catch this when others did not. A future patch that I have in development should annotate `spl_panic()`, so the others will catch this too. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14098
Diffstat (limited to 'cmd/zdb/zdb.c')
0 files changed, 0 insertions, 0 deletions