From patchwork Mon Jul 10 14:44:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107301 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3516729qge; Mon, 10 Jul 2017 07:46:01 -0700 (PDT) X-Received: by 10.84.224.133 with SMTP id s5mr17954747plj.93.1499697961035; Mon, 10 Jul 2017 07:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499697961; cv=none; d=google.com; s=arc-20160816; b=K56o08LrvCHehZGbvdCQvj0K8qsLDNg9iW0+Hn2BAD6aeEGvWtbHiNDgfPP9N0fXtX 19ic8QRqfp9W1ZdU0TL1rEtiJLW1MG+qfqoypOXbSqY+WkycOw5C8qIcW1YscohCf4lO 4iyJ0hIrArYSVICYBBpBw/7RcR9h9mwFgvNnZ7lw8uIscjm8Rogx52yH/rJ0hcq/iiMS jA1OPb2rHXDv0CQuaXu7zOD/u57EXHI1+fV24XbkseUq63lwJDyXF7Fwq+RHCP3RWHYi 80nUinC7bnpgJZ63xhGakXWvHvZWnTXnF8fF4q4W8H+bh6IUZm4caNaW36E/9+LV917l dJkA== 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 :message-id:date:subject:cc:to:from:arc-authentication-results; bh=49EqTyDF9e9P7sBPR7oKhuUsVpo7/pvNcea1IhBlXfc=; b=N0fHKxJg8WmGAr02nVGLH6nB+IjRhTmaCVEz8BcmowN5PobzFTJM+av32l/FZlxpRF vMR+YzDs30OtApf6ViAOyFUamOpumAmVaBqt63DgZkA1xYOjIKvqPUP8XpPEA09slIcj CGi3+1Mm+Cj1ZaY+hM/l36MDPOqLHSFPqVyR3adsCO7OGl0KBoKKu1Z+5QSAmZjhU+rX eSap/6uEWuSly/Lu6wsMWgAOa4Xbgdq+jwSI0QMmAgXCvR5K8EAvVyOJ50c1+AKJigDI DeLXlFRcJdPMPH4xj2z5NBpV1zSgknNIrOeYt/nx6h/JVp0sBf4w4F0qgBzpJeEXPdiL 2hXA== 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 z73si8021320pfi.49.2017.07.10.07.46.00; Mon, 10 Jul 2017 07:46:01 -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 S1754092AbdGJOpq (ORCPT + 25 others); Mon, 10 Jul 2017 10:45:46 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:56326 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753394AbdGJOpo (ORCPT ); Mon, 10 Jul 2017 10:45:44 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0Mh8jt-1dH9lo1MSv-00MI3X; Mon, 10 Jul 2017 16:44:33 +0200 From: Arnd Bergmann To: x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Kalle Valo , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, Arnd Bergmann Subject: [RFC 1/2] x86: mark target address as output in 'insb' asm Date: Mon, 10 Jul 2017 16:44:24 +0200 Message-Id: <20170710144425.2238584-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:j1PvX5guU+bnureQ+1CD9AwROLeJSpO5PFcLONVdmXkZiAxhpP6 nIQyZz07fLaAJ8bd/+a5Qhv89Jv+8Qrmk2vAVtSDGpDnm41NZynX7Rqahqs1jhwBJa/TULI 5BDpgwNB+qhbtqXh5SEL0bz+f/RLHlO0CpqMKxT6YhwlkwKqpX5R0dlR7haAnLsfs2xjeOV 8KmMj7UWpDwWY+EalS7sw== X-UI-Out-Filterresults: notjunk:1; V01:K0:u4r8qwiVcGI=:MBrxAIEzpg9GdFAsZc/hqh H9JeoCiHcl03JTY6wJfvPO1faztl10AjIZB3Eqdg5G/UVpnKeRs9OfqARLoKoCLSxxTrCYabu 7pRrOAhQ2j0gx6n0BxrgcmJD7XoM1ROFPlyJ0H5xuet2emXnScnewGqecp67CPskLL22IB7vF DX5NVKcEoR8S0q42uUZ7EodM3Yfu7RSSdOlOX4S17uEde5xo9+4a5+A77P8bmCE3/uq/CDleb QC1LGmLMzgLJEVs6xeQRJI7U8qxJ8rvii8W6VHPwu/XzNKPZmNU+nMKRi64OaQBAPMZKr9lax ZcIsQohEhJvpApp02omvPuHJSnO+uSkQcy41TdLs3G3jjNbFG+0zOg4AeZO4mdQ5CdVYcLv7M TbK8ZSAfDqrcKf5FpegL2fzHkDLsHMZRukPlijEm4j5mpcu4QdyiMG0fhHmslZ81MidLI94ig kR6VZvI4rAAJrn58Sp6T2OLIWyUMxXPyuT0RY3kG6vc9JNmHosAcfNFCLxQzSn2B9lo+Zir4W cwg+42ysBl+vbJf4c1+sbXTwcpaXw3+vRRCc7mQFwKpi2SIJyQnnse5JJ+JwRLsPFW+WTqUol 1/5CrJAy40fnIP+Ein9DuGMz9XUar3/Wk+rXf8Uk2AUa/dCERZoeh8sztvBs1YmGODOTHp1pi F/OzJdeJvI1bofje6fzkSZ4LyQ3H5UjNtswl4gZL/1KNyP++RBiEeRRqNftke6KO1qYXyWMdV HyWg0wpXNYQkESAL Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The -Wmaybe-uninitialized warning triggers for one driver using the output of the 'insb' I/O helper on x86: 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] Apparently the assember constraints are slightly off here, as marking the 'addr' argument as a memory output seems appropriate here and gets rid of the warning. For consistency I'm also adding it as input for outsb(). Unfortunately, this fix triggers another problem when CONFIG_KASAN is set, again only in this one driver: drivers/net/wireless/wl3501_cs.c: In function 'wl3501_rx_interrupt': drivers/net/wireless/wl3501_cs.c:1103:1: error: the frame size of 2232 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] I'm not an x86 person and gcc inline assembly mystifies me all the time, so please review this carefully and suggest a better way if this is not how it should be done. Signed-off-by: Arnd Bergmann --- arch/x86/include/asm/io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.0 diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 7afb0e2f07f4..d107251eabd9 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -328,13 +328,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), "m" (addr));\ } \ \ 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), "=m" (addr) : "d"(port));\ } BUILDIO(b, b, char) From patchwork Mon Jul 10 14:44:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 107300 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3516723qge; Mon, 10 Jul 2017 07:46:00 -0700 (PDT) X-Received: by 10.98.133.16 with SMTP id u16mr45850339pfd.140.1499697960628; Mon, 10 Jul 2017 07:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499697960; cv=none; d=google.com; s=arc-20160816; b=OloGSKXWELCkcEqB2N6UPoiBkYD680cS2X/C6CkIWGEIXU5y+ylSAHwtDJzEuuET+o zo9PCMWdSSSqxUpIbXXP2jVxEuP+EfF683Tz/LxWHyoFec2v9MEWkCT5VM4H6OwxQcWI u1eUOUQjzy1om1GSRFH0s6FzUBhc/OXVtNOEVef7xyRjUamUDcv4shRD4jLzl+tfNLKe 1uqtcY+RvNh4Qs9lugAsRHxwaXBZTD7BmVUDg1GZb43QALEv/c2vPi1hCO3Ki69dsHff qCDCw4SYDdYzN8k5Te5dK/bXl8ZArBnoKsNfXts/CAiHPRhK5sUkZJ5Ei2My/Z9vrOKf xBfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=5ONPLKRax57dfg72Nkcb65DB3DUKv/tDMc2nyG5C1fw=; b=oopphN46TA6NWKpjMdgwHOFsZH5OWxwEYZDEARjQvxVNzRNMMK7vrXQp8RA73zr5EW +ktgFLWVkF41Dzf3kj2ZRiOicsdfSJbp/+HE3quKFzNvxSpfhv/+s0NziXld1Y1LMag7 L9nrPIYNs5Uos2zcH7YJgdQcBPt8MOEb08a9eh3l6yhtNwecgBmnWNOcMnbeo07yHLSb 7DkFlQSphFW3aV/VBbe+fcIsivO9Bbg/QzGwYq+imqr3yGl1uXLaKOGp+u24D7uKdn9O S5TLxgIeryd+kvdDJAo7BrW4Nf02bVLCRSrV2HyzNRt5EFDFS5vPaHpr2Abfu4GUhbdv lskg== 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 z73si8021320pfi.49.2017.07.10.07.46.00; Mon, 10 Jul 2017 07:46:00 -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 S1754066AbdGJOpm (ORCPT + 25 others); Mon, 10 Jul 2017 10:45:42 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:56187 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753394AbdGJOpl (ORCPT ); Mon, 10 Jul 2017 10:45:41 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0MfE8E-1dJ5Rr2nm6-00OmEK; Mon, 10 Jul 2017 16:44:33 +0200 From: Arnd Bergmann To: x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Kalle Valo , linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, Arnd Bergmann Subject: [RFC 2/2] wl3501_cs: reduce stack size for KASAN Date: Mon, 10 Jul 2017 16:44:25 +0200 Message-Id: <20170710144425.2238584-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170710144425.2238584-1-arnd@arndb.de> References: <20170710144425.2238584-1-arnd@arndb.de> X-Provags-ID: V03:K0:hQK/HbOz94xxVR2UHagG2MTeGlCYF2GHgozK4pZlGbQd3HXFYZR sDGLSGg5tpdV5cBYCqrWWh1H43ImPJ+LH7jzBnX3pADiYMnhErzTmIZnAg/JHyoBd4vX5F/ 0MMtXO3j428zXc+aLZgPjTXj7AsPjV5Gtps9uHbRfJdtA/9lSeZLESdWjubT4EeT5eeGf6h cg2o3VEJiaNKjRWqYBrDw== X-UI-Out-Filterresults: notjunk:1; V01:K0:bTltFPUyps0=:I8zf4c4NslDBBIWC9s/GNQ 7PLKMjlaVAilBYpaTPnECER175fsEPfQ6aq+iqV5x0tdTHt4xWRStqJpZRZNngrmo45/Nd29F m/LcwtKbXoP03I2l5S514J4QzxWBm8Hsga0sqhJv0o38M/akxJ3vHwuLBjdDvRWy9uVwz91P0 UgEVb8mm8x5FKEshBF/9lb7Pd+r1qkb25RxIPWdRH1Tt+B2val7xujWBkF4Appc2VCTUOwKJp snZP979WBRVqUnqaytyJ6ZL+bMSx/zV1hSdzBvg0LrwK7oSw0mnc+cgcGHydIIH3nXF43Uk8w NMBGX2Uu+0UET/0hnmtz8nRmQL0n6b6i5zLGdNEf3Aj34zFg8T/6Ty9qqcPixCR+rlr6lp4iM POMWgurNBTJhL9uPgu7DKyk+dTVUHhXo/DSvD1gTVQOh1JRhpJpoqu9bYXzytxll/w4zLvDVh yipiapazqdnuRU5UIPKUzh+dttAjvCu64YaEQ8E8CGK99mtyxi9TmeMws5oBRx2VEaXXn2Rl3 BYIk3rSFCu2rlYSTdExDEjXu3yCBi2V3veReFHcntOTGGqCHBJPDzoYIMpDTHSnzDi1CnFCQT 9yKEr+/PsxRhr/1ry1PsTiDviP5AP9kw9vPTjC3hO+ueVseknjqcpB3VDlKax/7dC26nwqXdM BnyfsNiVGkGGwhegVl3mX85tL7vZrgLSB+BqZpJ+5QM0oPkQEiJ3Ec2YvDubTWdrEu8M= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Inlining functions with local variables can lead to excessive stack usage with KASAN after a previous patch that modifies the outsb/insb helpers on x86. drivers/net/wireless/wl3501_cs.c: In function 'wl3501_rx_interrupt': drivers/net/wireless/wl3501_cs.c:1103:1: error: the frame size of 2232 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] Marking the two callers of insb/outb 'noinline' prevents the compiler from adding up the stack usage for each of the local variables passed into those, reducing the maximum stack frame size to 800 bytes with KASAN again. Signed-off-by: Arnd Bergmann --- drivers/net/wireless/wl3501_cs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index acec0d9ec422..2cce22571b4c 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -242,8 +242,8 @@ static int wl3501_get_flash_mac_addr(struct wl3501_card *this) * * Move 'size' bytes from PC to card. (Shouldn't be interrupted) */ -static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, - int size) +static noinline void wl3501_set_to_wla(struct wl3501_card *this, + u16 dest, void *src, int size) { /* switch to SRAM Page 0 */ wl3501_switch_page(this, (dest & 0x8000) ? WL3501_BSS_SPAGE1 : @@ -264,8 +264,8 @@ static void wl3501_set_to_wla(struct wl3501_card *this, u16 dest, void *src, * * Move 'size' bytes from card to PC. (Shouldn't be interrupted) */ -static void wl3501_get_from_wla(struct wl3501_card *this, u16 src, void *dest, - int size) +static noinline void wl3501_get_from_wla(struct wl3501_card *this, + u16 src, void *dest, int size) { /* switch to SRAM Page 0 */ wl3501_switch_page(this, (src & 0x8000) ? WL3501_BSS_SPAGE1 :