• Arnd Bergmann's avatar
    auxdisplay: ht16k33: don't access uninitialized data · e1f990c2
    Arnd Bergmann authored
    gcc-7.0.1 points out that we copy uninitialized data from the stack
    into a per-device structure:
    
    drivers/auxdisplay/ht16k33.c: In function 'ht16k33_keypad_irq_thread':
    arch/x86/include/asm/string_32.h:78:16: error: 'new_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    arch/x86/include/asm/string_32.h:79:22: error: '*((void *)&new_state+4)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    
    The access is harmless because we never read the data, but we are better
    off not doing this, so this changes the code to only copy the data
    that was actually initialized. To make sure we don't overflow the
    stack with an incorrect DT, we also need to add a sanity checkin the
    probe function.
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarRobin van der Gracht <robin@protonic.nl>
    Reviewed-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e1f990c2
ht16k33.c 13.6 KB