From patchwork Thu Jun 22 17:13:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9804979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 04E2060329 for ; Thu, 22 Jun 2017 17:17:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DE462858C for ; Thu, 22 Jun 2017 17:17:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 523B2285C4; Thu, 22 Jun 2017 17:17:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C819E2858C for ; Thu, 22 Jun 2017 17:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753517AbdFVROo (ORCPT ); Thu, 22 Jun 2017 13:14:44 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:50432 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752466AbdFVROm (ORCPT ); Thu, 22 Jun 2017 13:14:42 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0Me5Bm-1d99Hv2Qvu-00Pso9; Thu, 22 Jun 2017 19:14:05 +0200 From: Arnd Bergmann To: Andrew Morton Cc: kasan-dev@googlegroups.com, Dmitry Vyukov , Alexander Potapenko , Andrey Ryabinin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Arend van Spriel , Arnd Bergmann , Masahiro Yamada , Michal Marek , Kees Cook , Ingo Molnar , "David S . Miller" , linux-kbuild@vger.kernel.org, Samuel Thibault , Greg Kroah-Hartman , Jiri Slaby Subject: [PATCH v3 03/11] rocker: mark rocker_tlv_put_* functions as noinline_if_stackbloat Date: Thu, 22 Jun 2017 19:13:47 +0200 Message-Id: <20170622171355.267192-4-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170622171355.267192-1-arnd@arndb.de> References: <20170622171355.267192-1-arnd@arndb.de> X-Provags-ID: V03:K0:HjDhxuI7Kaf8iKu+oYw8ySLB2MJbPUOykZUtN6zTamUSsei/pxi QWpP6h8tCvS3E2ZhqtwA8F3XJPI7OnwwDh1kh2NxJeJE47lTTq8lSfbq0M+knEBEZ+smSZH rQr5C5klQPcwA4d0uad0uXLOhr8nwWi+AhZTdCljtbugsG0YNLZdnyXQABLkFE/DPLAWKqq oJhqFY5qJ6ON6yKBXf1vg== X-UI-Out-Filterresults: notjunk:1; V01:K0:os4A8fB38Ew=:zX1ky85UNCR9zIjmHkgtfN aMuL8w4KQP8KcigsrbR+m1q7XKQjwqMjWmfN9A590vuIJ0j5VeYuWAb+Y6Dlit7ycjwl2bcvc KMdCNyjgR0a2/PIBhstM2f5Gj2VhkdgJ7zWPcgLZrA8vZVpLh+LbiZHEdQ4bOKX0Sr29oOBBs aBSvxFQso9eCYAhWo2xvfIajeYBI7eh+bClpULGE9FWu/vjVrRBdlx08lejMF5zonIlr11CXh Dg6PG49Bu1qiuTv1ii+t8if038klZQZ927mtFVYTUSxrXtleXQ/Alc//3p/OIO5lZpZGn1EGt Py9BRK3cl8K44vmIV5NJ0al32/S4QGVH9mQypk4Xz3y4Krp2736uJx7355iJCShYiX93pzRoD cBICdn+Oc1C8miRHolHWJj3B6iBI70D4yvT4L5JZiyHS4YJcPUgoFsPQC97E8uZqWlQClfbwS 3JeZDG1oI7yHw3lPygLBmDy0ZKppuYgFVAOx+Xfd5qgCPC/bBSAxiS1+cd/eYUYkZiJUgKIRy tVRo4Qh2xYqT2U5fMdUYKY2BGPVxIDmsandgJGZPvo7PUxTYZl6pTxqbjGvgG0mY0JzqOMPU0 2kCgsI6+68sQcUPfP3CrPdmne+wbGNijngvkYYPCy4cbSlbnwfZmd9+0LJasfJpJkKv3KqeZj 3czqyF83bFLlS3FwFSFaEvDI3XhLw+J7r808ptHrS+OIk/ttAwoHgoU6UV8QXgO05FRY= Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Inlining these functions creates lots of stack variables when KASAN is enabled, leading to this warning about potential stack overflow: drivers/net/ethernet/rocker/rocker_ofdpa.c: In function 'ofdpa_cmd_flow_tbl_add': drivers/net/ethernet/rocker/rocker_ofdpa.c:621:1: error: the frame size of 2752 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] This marks all of them noinline_if_stackbloat, which solves the problem by keeping the redzone inside of the separate stack frames. Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/rocker/rocker_tlv.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/rocker/rocker_tlv.h b/drivers/net/ethernet/rocker/rocker_tlv.h index a63ef82e7c72..8970a414eb5b 100644 --- a/drivers/net/ethernet/rocker/rocker_tlv.h +++ b/drivers/net/ethernet/rocker/rocker_tlv.h @@ -139,38 +139,38 @@ rocker_tlv_start(struct rocker_desc_info *desc_info) int rocker_tlv_put(struct rocker_desc_info *desc_info, int attrtype, int attrlen, const void *data); -static inline int rocker_tlv_put_u8(struct rocker_desc_info *desc_info, - int attrtype, u8 value) +static noinline_if_stackbloat int +rocker_tlv_put_u8(struct rocker_desc_info *desc_info, int attrtype, u8 value) { return rocker_tlv_put(desc_info, attrtype, sizeof(u8), &value); } -static inline int rocker_tlv_put_u16(struct rocker_desc_info *desc_info, - int attrtype, u16 value) +static noinline_if_stackbloat int +rocker_tlv_put_u16(struct rocker_desc_info *desc_info, int attrtype, u16 value) { return rocker_tlv_put(desc_info, attrtype, sizeof(u16), &value); } -static inline int rocker_tlv_put_be16(struct rocker_desc_info *desc_info, - int attrtype, __be16 value) +static noinline_if_stackbloat int +rocker_tlv_put_be16(struct rocker_desc_info *desc_info, int attrtype, __be16 value) { return rocker_tlv_put(desc_info, attrtype, sizeof(__be16), &value); } -static inline int rocker_tlv_put_u32(struct rocker_desc_info *desc_info, - int attrtype, u32 value) +static noinline_if_stackbloat int +rocker_tlv_put_u32(struct rocker_desc_info *desc_info, int attrtype, u32 value) { return rocker_tlv_put(desc_info, attrtype, sizeof(u32), &value); } -static inline int rocker_tlv_put_be32(struct rocker_desc_info *desc_info, - int attrtype, __be32 value) +static noinline_if_stackbloat int +rocker_tlv_put_be32(struct rocker_desc_info *desc_info, int attrtype, __be32 value) { return rocker_tlv_put(desc_info, attrtype, sizeof(__be32), &value); } -static inline int rocker_tlv_put_u64(struct rocker_desc_info *desc_info, - int attrtype, u64 value) +static noinline_if_stackbloat int +rocker_tlv_put_u64(struct rocker_desc_info *desc_info, int attrtype, u64 value) { return rocker_tlv_put(desc_info, attrtype, sizeof(u64), &value); }