From patchwork Wed Nov 1 21:26:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Willy Tarreau X-Patchwork-Id: 117735 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1372122qgn; Wed, 1 Nov 2017 14:28:49 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TDSc01uSHu8venygc2kyEj/SsMVI2xyr4r/Biz7E++Ym/bqNGKK+/u8WNtKYcChja9nB7i X-Received: by 10.98.75.77 with SMTP id y74mr1286237pfa.78.1509571729144; Wed, 01 Nov 2017 14:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509571729; cv=none; d=google.com; s=arc-20160816; b=kLIWsXRBV5IeDmgOCKj0xK6fDhW3nTZhmFeNOb8hdmD6nlOtkNcczkQEbyBEhnhp7K cp06N1aKYzxFJHGbHezb1LOqM8f4GH09PfdnCHg1q97jhIq4vU9S1VjBVvW3A4cE7kUs XwsofDwwGUwp2v7y+fgZfFbEdT4DB2kflg7UPnKbl3cWn82Q5Yai31qXP+teG+ChNxpI XHVNJLSAZ+0aU5cHa0l4/sXyr1K4aYGDJXthPur/1pYhy60zi78N5O7KFQe1JcN3Rpc1 2EjzQ4uUMrQlQ1p7g9UaLHpul5wxBuQgRPqq/eaY2SPHWeQoxwPGwCtZ1ljCckxpeXTm dqXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yHgtmBw4782gle+SRLJvXWeUILp06JwT7UI/OHz0q6E=; b=IizjPc1Rj+F/wR/rev50ty5N2zmL7LKWNbojrST5mV9ylMAbXOvJORqgAJSsRplIYX pKOK+cN+YkyKa3F0rshtSZ9Cn/7/2JsVOIQI59PCrFTdHVwFANn/Yzm5NhNB7IV/12+x 6VL6f5094wEjff7U2RD0E7ZC/HSkay/zQ0O586L7QyfYKEYca1Bi1dvpCzoHj52yBuVk cMwS75qIPV8YJ+6beR7c5vODWlVx0j3ayIbPqR9Ezxl4g9sy0bTeEqTgVqTAWQDJUrlQ KzKJEcufvPqDEa4xam0SOioOnE7mNtJlvk7gstDxt3h9y/XY/O5AlB4PIAD/rmnyru8X KONA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si1836787pgp.379.2017.11.01.14.28.48; Wed, 01 Nov 2017 14:28:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934335AbdKAV2p (ORCPT + 26 others); Wed, 1 Nov 2017 17:28:45 -0400 Received: from wtarreau.pck.nerim.net ([62.212.114.60]:35412 "EHLO 1wt.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934318AbdKAV2m (ORCPT ); Wed, 1 Nov 2017 17:28:42 -0400 Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id vA1LQowW004989; Wed, 1 Nov 2017 22:26:50 +0100 From: Willy Tarreau To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, linux@roeck-us.net Cc: Arnd Bergmann , Borislav Petkov , Peter Zijlstra , Thomas Gleixner , Tom Lendacky , Ingo Molnar , Willy Tarreau Subject: [PATCH 3.10 089/139] x86/io: Add "memory" clobber to insb/insw/insl/outsb/outsw/outsl Date: Wed, 1 Nov 2017 22:26:30 +0100 Message-Id: <1509571600-4858-40-git-send-email-w@1wt.eu> X-Mailer: git-send-email 2.8.0.rc2.1.gbe9624a In-Reply-To: <1509571600-4858-1-git-send-email-w@1wt.eu> References: <1509571159-4405-1-git-send-email-w@1wt.eu> <1509571600-4858-1-git-send-email-w@1wt.eu> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann commit 7206f9bf108eb9513d170c73f151367a1bdf3dbf upstream. 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: Linus Torvalds Signed-off-by: Arnd Bergmann Acked-by: Linus Torvalds Cc: Borislav Petkov Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Tom Lendacky Link: http://lkml.kernel.org/r/20170719125310.2487451-5-arnd@arndb.de Link: https://lkml.org/lkml/2017/7/12/605 Signed-off-by: Ingo Molnar Signed-off-by: Willy Tarreau --- arch/x86/include/asm/io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.8.0.rc2.1.gbe9624a diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index d8e8eef..86ec87d 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -296,13 +296,13 @@ static inline unsigned type in##bwl##_p(int port) \ static inline void outs##bwl(int port, const void *addr, unsigned long count) \ { \ asm volatile("rep; outs" #bwl \ - : "+S"(addr), "+c"(count) : "d"(port)); \ + : "+S"(addr), "+c"(count) : "d"(port) : "memory"); \ } \ \ static inline void ins##bwl(int port, void *addr, unsigned long count) \ { \ asm volatile("rep; ins" #bwl \ - : "+D"(addr), "+c"(count) : "d"(port)); \ + : "+D"(addr), "+c"(count) : "d"(port) : "memory"); \ } BUILDIO(b, b, char)