• Arnd Bergmann's avatar
    x86/io: Add "memory" clobber to insb/insw/insl/outsb/outsw/outsl · 7206f9bf
    Arnd Bergmann authored
    The x86 version of insb/insw/insl uses an inline assembly that does
    not have the target buffer listed as an output. This can confuse
    the compiler, leading it to think that a subsequent access of the
    buffer is uninitialized:
    
      drivers/net/wireless/wl3501_cs.c: In function ‘wl3501_mgmt_scan_confirm’:
      drivers/net/wireless/wl3501_cs.c:665:9: error: ‘sig.status’ is used uninitialized in this function [-Werror=uninitialized]
      drivers/net/wireless/wl3501_cs.c:668:12: error: ‘sig.cap_info’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      drivers/net/sb1000.c: In function 'sb1000_rx':
      drivers/net/sb1000.c:775:9: error: 'st[0]' is used uninitialized in this function [-Werror=uninitialized]
      drivers/net/sb1000.c:776:10: error: 'st[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
      drivers/net/sb1000.c:784:11: error: 'st[1]' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    
    I tried to mark the exact input buffer as an output here, but couldn't
    figure it out. As suggested by Linus, marking all memory as clobbered
    however is good enough too. For the outs operations, I also add the
    memory clobber, to force the input to be written to local variables.
    This is probably already guaranteed by the "asm volatile", but it can't
    hurt to do this for symmetry.
    Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Tom Lendacky <thomas.lendacky@amd.com>
    Link: http://lkml.kernel.org/r/20170719125310.2487451-5-arnd@arndb.de
    Link: https://lkml.org/lkml/2017/7/12/605Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    7206f9bf
io.h 11.2 KB