summary refs log tree commit diff
path: root/crypto/cast5_generic.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2020-03-06 09:32:13 -0800
committerDaniel Vetter <daniel.vetter@ffwll.ch>2020-03-16 10:54:08 +0100
commitdeec222e09a69d6d7b542c7367615bfad802c756 (patch)
tree8eea290f24dd0417b18b9fe4f78e2ce62ad161fa /crypto/cast5_generic.c
parentbd50d4a2168370b822b3e31b1ba808cd04bd65de (diff)
downloadlinux-deec222e09a69d6d7b542c7367615bfad802c756.tar.gz
drm/edid: Distribute switch variables for initialization
Variables declared in a switch statement before any case statements
cannot be automatically initialized with compiler instrumentation (as
they are not part of any execution flow). With GCC's proposed automatic
stack variable initialization feature, this triggers a warning (and they
don't get initialized). Clang's automatic stack variable initialization
(via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
doesn't initialize such variables[1]. Note that these warnings (or silent
skipping) happen before the dead-store elimination optimization phase,
so even when the automatic initializations are later elided in favor of
direct initializations, the warnings remain.

To avoid these problems, lift such variables up into the next code
block.

drivers/gpu/drm/drm_edid.c: In function ‘drm_edid_to_eld’:
drivers/gpu/drm/drm_edid.c:4395:9: warning: statement will never be
executed [-Wswitch-unreachable]
 4395 |     int sad_count;
      |         ^~~~~~~~~

[1] https://bugs.llvm.org/show_bug.cgi?id=44916

v2: move into function block instead being switch-local (Ville Syrjälä)

Signed-off-by: Kees Cook <keescook@chromium.org>
[danvet: keep the changelog]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/202003060930.DDCCB6659@keescook
Diffstat (limited to 'crypto/cast5_generic.c')
0 files changed, 0 insertions, 0 deletions