{"id":817718,"url":"http://patchwork.ozlabs.org/api/patches/817718/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/20170922212930.620249-8-arnd@arndb.de/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170922212930.620249-8-arnd@arndb.de>","list_archive_url":null,"date":"2017-09-22T21:29:18","name":"[v4,7/9] rocker: fix rocker_tlv_put_* functions for KASAN","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"99cc13357618438accf73a7465ffd9edc135106e","submitter":{"id":30,"url":"http://patchwork.ozlabs.org/api/people/30/?format=json","name":"Arnd Bergmann","email":"arnd@arndb.de"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/20170922212930.620249-8-arnd@arndb.de/mbox/","series":[{"id":4712,"url":"http://patchwork.ozlabs.org/api/series/4712/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=4712","date":"2017-09-22T21:29:16","name":"bring back stack frame warning with KASAN","version":4,"mbox":"http://patchwork.ozlabs.org/series/4712/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817718/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817718/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xzRXr2y0Wz9s9Y\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSat, 23 Sep 2017 07:33:00 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752800AbdIVVcr (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tFri, 22 Sep 2017 17:32:47 -0400","from mout.kundenserver.de ([212.227.126.130]:54979 \"EHLO\n\tmout.kundenserver.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752395AbdIVVco (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Fri, 22 Sep 2017 17:32:44 -0400","from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de\n\t(mreue002 [212.227.15.129]) with ESMTPA (Nemesis) id\n\t0M1eYM-1d7P5u1rre-00tmVw; Fri, 22 Sep 2017 23:31:12 +0200"],"From":"Arnd Bergmann <arnd@arndb.de>","To":"Jiri Pirko <jiri@resnulli.us>","Cc":"Arnd Bergmann <arnd@arndb.de>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>, Arend van Spriel\n\t<arend.vanspriel@broadcom.com>, Kalle Valo <kvalo@codeaurora.org>,\n\t\"David S. Miller\" <davem@davemloft.net>, \n\tAndrey Ryabinin <aryabinin@virtuozzo.com>, Alexander Potapenko\n\t<glider@google.com>,         Dmitry Vyukov <dvyukov@google.com>,\n\tMasahiro Yamada <yamada.masahiro@socionext.com>, \n\tMichal Marek <mmarek@suse.com>,\n\tAndrew Morton <akpm@linux-foundation.org>, Kees Cook\n\t<keescook@chromium.org>, Geert Uytterhoeven <geert@linux-m68k.org>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>, \n\tlinux-media@vger.kernel.org, linux-kernel@vger.kernel.org, \n\tnetdev@vger.kernel.org, linux-wireless@vger.kernel.org, \n\tbrcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com,\n\tkasan-dev@googlegroups.com, linux-kbuild@vger.kernel.org,\n\tJakub Jelinek <jakub@gcc.gnu.org>, =?utf-8?q?Martin_Li=C5=A1ka?=\n\t<marxin@gcc.gnu.org>,         stable@vger.kernel.org","Subject":"[PATCH v4 7/9] rocker: fix rocker_tlv_put_* functions for KASAN","Date":"Fri, 22 Sep 2017 23:29:18 +0200","Message-Id":"<20170922212930.620249-8-arnd@arndb.de>","X-Mailer":"git-send-email 2.9.0","In-Reply-To":"<20170922212930.620249-1-arnd@arndb.de>","References":"<20170922212930.620249-1-arnd@arndb.de>","X-Provags-ID":"V03:K0:ocpyRAgyJ4TPg1pGKyh1loLMcVmRjDmXhzPdpsOW+QsUHEzbq8a\n\tygbIwmnz74dwWw3W7IXJr53pPmj74VDTVlUH77KmuPec6bE8u/Wp3H6itdpQbuNG+Xo1XFs\n\tgKa668/udITvo896lSBqLk7HeggqYM8zOG9naAGMUhgzfSmf6iqbi3dzKytgnhxWWUGipBa\n\t8GAA2GCKQI1yAeqqjjfRw==","X-UI-Out-Filterresults":"notjunk:1; V01:K0:B6NOhgN9314=:14eLMuBTywzhXmykIvWIJC\n\t3DYHueB4rVOedFXnWLeyOd8JhFL1CemgSjhm+K501ZtYu7f+tAHK6WEbkdAgmjaxQiQA4EYEL\n\tBMcxPI/lj/lVkJlmr+29g/0wkH1SxtRO1/+T9q3YyGp3P2PvOk883uqmX+bOQAV0AM9vVghan\n\t+4LEdi0ejSIxJS+EgpVC6V8GGnwm6rMalXJUJjF1skvdPpDjOqmX1JAEn9YQ9Ij3D6nSmsIAb\n\tl1vrEQKzNoGHDxCRpT0DkJnSMxq7ZVVEKlu4z5F6qiMXo8HbEVJdaX5h9tNDBbwRIoQNDnV+O\n\tk1dHFefZpL7DBufQJHdk3dbzE9gUYtipvPUVfs1MAixQ6t0+i0DkdvqcHAidfr8b5EZ4NHuXn\n\tDgnYlCv3mTWo5iEHbnVWk+0irlx48tVqMZdGH9xbAGH7E7anzIo7+Frr/nx/SoRC6qd+YVnuW\n\tu5gWbPrhuwioGcPB1u8KGr9wPwHjKsLe8PMBsrfH/pEPwWp99W8Gwisu+bQXaM4LtB7J8Ee1b\n\tL7bEbPbRQ+Qzw4D4ZxU9ALTtQKFktA0SDRuXkd19LP3KyO3I3Wew7XUd9WknyzngULpUYF7br\n\tHZZYTlSaOJMeYzK7UKyvy36XxD6NB0yteHRRlDrlRB+U+Q7Q02iJv6ub1XStVDAeOdqWpjc/8\n\tsr5UNYZ8BuX8G3776Hv0UVZ69XceLefujyy7qLrIctefn7tZNgyAy5c1lB6wdfxDemCOmlcx/\n\t7XJ34tG8rs2gcGC57KE6bmWKXwEIH9jbdprp9Q==","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Inlining these functions creates lots of stack variables that each take\n64 bytes when KASAN is enabled, leading to this warning about potential\nstack overflow:\n\ndrivers/net/ethernet/rocker/rocker_ofdpa.c: In function 'ofdpa_cmd_flow_tbl_add':\ndrivers/net/ethernet/rocker/rocker_ofdpa.c:621:1: error: the frame size of 2752 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]\n\ngcc-8 can now consolidate the stack slots itself, but on older versions\nwe get the same behavior by using a temporary variable that holds a\ncopy of the inline function argument.\n\nCc: stable@vger.kernel.org\nLink: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715\nSigned-off-by: Arnd Bergmann <arnd@arndb.de>\n---\n drivers/net/ethernet/rocker/rocker_tlv.h | 48 ++++++++++++++++++++------------\n 1 file changed, 30 insertions(+), 18 deletions(-)","diff":"diff --git a/drivers/net/ethernet/rocker/rocker_tlv.h b/drivers/net/ethernet/rocker/rocker_tlv.h\nindex a63ef82e7c72..dfae3c9d57c6 100644\n--- a/drivers/net/ethernet/rocker/rocker_tlv.h\n+++ b/drivers/net/ethernet/rocker/rocker_tlv.h\n@@ -139,40 +139,52 @@ rocker_tlv_start(struct rocker_desc_info *desc_info)\n int rocker_tlv_put(struct rocker_desc_info *desc_info,\n \t\t   int attrtype, int attrlen, const void *data);\n \n-static inline int rocker_tlv_put_u8(struct rocker_desc_info *desc_info,\n-\t\t\t\t    int attrtype, u8 value)\n+static inline int\n+rocker_tlv_put_u8(struct rocker_desc_info *desc_info, int attrtype, u8 value)\n {\n-\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u8), &value);\n+\tu8 tmp = value; /* work around GCC PR81715 */\n+\n+\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u8), &tmp);\n }\n \n-static inline int rocker_tlv_put_u16(struct rocker_desc_info *desc_info,\n-\t\t\t\t     int attrtype, u16 value)\n+static inline int\n+rocker_tlv_put_u16(struct rocker_desc_info *desc_info, int attrtype, u16 value)\n {\n-\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u16), &value);\n+\tu16 tmp = value;\n+\n+\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u16), &tmp);\n }\n \n-static inline int rocker_tlv_put_be16(struct rocker_desc_info *desc_info,\n-\t\t\t\t      int attrtype, __be16 value)\n+static inline int\n+rocker_tlv_put_be16(struct rocker_desc_info *desc_info, int attrtype, __be16 value)\n {\n-\treturn rocker_tlv_put(desc_info, attrtype, sizeof(__be16), &value);\n+\t__be16 tmp = value;\n+\n+\treturn rocker_tlv_put(desc_info, attrtype, sizeof(__be16), &tmp);\n }\n \n-static inline int rocker_tlv_put_u32(struct rocker_desc_info *desc_info,\n-\t\t\t\t     int attrtype, u32 value)\n+static inline int\n+rocker_tlv_put_u32(struct rocker_desc_info *desc_info, int attrtype, u32 value)\n {\n-\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u32), &value);\n+\tu32 tmp = value;\n+\n+\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u32), &tmp);\n }\n \n-static inline int rocker_tlv_put_be32(struct rocker_desc_info *desc_info,\n-\t\t\t\t      int attrtype, __be32 value)\n+static inline int\n+rocker_tlv_put_be32(struct rocker_desc_info *desc_info, int attrtype, __be32 value)\n {\n-\treturn rocker_tlv_put(desc_info, attrtype, sizeof(__be32), &value);\n+\t__be32 tmp = value;\n+\n+\treturn rocker_tlv_put(desc_info, attrtype, sizeof(__be32), &tmp);\n }\n \n-static inline int rocker_tlv_put_u64(struct rocker_desc_info *desc_info,\n-\t\t\t\t     int attrtype, u64 value)\n+static inline int\n+rocker_tlv_put_u64(struct rocker_desc_info *desc_info, int attrtype, u64 value)\n {\n-\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u64), &value);\n+\tu64 tmp = value;\n+\n+\treturn rocker_tlv_put(desc_info, attrtype, sizeof(u64), &tmp);\n }\n \n static inline struct rocker_tlv *\n","prefixes":["v4","7/9"]}