]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit - scripts/gcc-plugins/stackleak_plugin.c
gcc-plugins/stackleak: Avoid assignment for unused macro argument
authorKees Cook <keescook@chromium.org>
Thu, 2 Apr 2020 07:53:47 +0000 (00:53 -0700)
committerKees Cook <keescook@chromium.org>
Mon, 13 Apr 2020 17:17:44 +0000 (10:17 -0700)
commit8d97fb393c5cbae23389317615f2bf30a559ed17
treecd6b807d48e530dc732f61c9a8d549021d0928b8
parent8f3d9f354286745c751374f5f1fcafee6b3f3136
gcc-plugins/stackleak: Avoid assignment for unused macro argument

With GCC version >= 8, the cgraph_create_edge() macro argument using
"frequency" goes unused. Instead of assigning a temporary variable for
the argument, pass the compute_call_stmt_bb_frequency() call directly
as the macro argument so that it will just not be called when it is
not wanted by the macros.

Silences the warning:

scripts/gcc-plugins/stackleak_plugin.c:54:6: warning: variable ‘frequency’ set but not used [-Wunused-but-set-variable]

Now builds cleanly with gcc-7 and gcc-9. Both boot and pass
STACKLEAK_ERASING LKDTM test.

Signed-off-by: Kees Cook <keescook@chromium.org>
scripts/gcc-plugins/stackleak_plugin.c