From patchwork Thu Mar 2 16:38:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9601389 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 0BC8760522 for ; Thu, 2 Mar 2017 19:03:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1ECF285C9 for ; Thu, 2 Mar 2017 19:03:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6F52285DD; Thu, 2 Mar 2017 19:03:03 +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=ham 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 372AC285C9 for ; Thu, 2 Mar 2017 19:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752636AbdCBTDB (ORCPT ); Thu, 2 Mar 2017 14:03:01 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:65022 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbdCBTC4 (ORCPT ); Thu, 2 Mar 2017 14:02:56 -0500 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.129]) with ESMTPA (Nemesis) id 0MEwBu-1cUfdu0sYc-00G04l; Thu, 02 Mar 2017 17:39:00 +0100 From: Arnd Bergmann To: kasan-dev@googlegroups.com Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-wireless@vger.kernel.org, kernel-build-reports@lists.linaro.org, "David S . Miller" , Arnd Bergmann , Joe Perches Subject: [PATCH 24/26] ocfs2: reduce stack size with KASAN Date: Thu, 2 Mar 2017 17:38:32 +0100 Message-Id: <20170302163834.2273519-25-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170302163834.2273519-1-arnd@arndb.de> References: <20170302163834.2273519-1-arnd@arndb.de> X-Provags-ID: V03:K0:6/NuxVeKk/Z12t4ir4vzfrVVFr/cCmPBUCmCct5SK2sPiEOuoRs WMWu5EB2KTYUNSmY8PR1YzXLCOf4zgRMPqmTeqzBWaDjoEVovB14ptCcau+yyeJnRF6F9WN 39T9/vofrURjb4sSkEOO/A0Fwf4dZWrINGNdaUNcKY4DyTLtTyk2Z9p1T13KXR7+24M33r2 pyKp+O3t8hd2Rn7k9Su/A== X-UI-Out-Filterresults: notjunk:1; V01:K0:WkmprvKKaug=:OfLjEe3Q1Ia5DIzvzurmJd lLh2hKJdsy22fO9YQxTlsgyvH7XgfDyjs1mQxEWekMz7AVVOLj7zbXGSazYoWQsKaRO++xE4d G/fkhSnsAARS+AV5cdPu5hHPq83m70raN/Cp7jKv3gVMjwRh2863aZU+gKRLzqlvIxLhaeRlR 6O5E2E4QzfwiEq+Q41VWjSAsl4wG/4Y5YgEAeLCwa0a3//Eh8k3DcVn/ztkudtKamMlHb3kJf mCRDPpRGtL2Va9B6DraMzIn7YzM/EfYxhE5yP4lm7H7XTaVOYS7B+9FLbYDVccVxnNBehxVNI LsA/M1O1GVEwoM8aO2p1PPTO5thvgALVOcXC9hEk427D6CDwEecGX7hSA3jxOix3m5CZQTYVn 7FsLwfZY55gSflrveDFD1HuflfRD/zJVKCs9xwkSMJxGb88aY3IMtib7XWPkB689Hlq4Civhq AxelZU/hxRQwrD3N1s0WutE2Dy5dBYikNGuE6SA/c42M7vN9w/p1SzI0yQMELD0y97tf/BHG+ 5aO5K8A0As6kKnYCAX9lqRqEMszjlMl23JVeqid2EYUcwpa2rHiwq7eCNrdQ/x6B/RyfJcihs 9LafHzGoSKcw4VJpELeKNafz/OulLCLonh1ir4gSLmePbFVlAtSZzbAmppm//KiSp42qeJsYh xazztJ8rpGTOUf0Sru1FzWYoW9Yqeev2eXSiOMT4nnjY0GmCohkaEQ9YEEp76tO9i/9E= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The internal logging infrastructure in ocfs2 causes special warning code to be used with KASAN, which produces rather large stack frames: fs/ocfs2/super.c: In function 'ocfs2_fill_super': fs/ocfs2/super.c:1219:1: error: the frame size of 3264 bytes is larger than 3072 bytes [-Werror=frame-larger-than=] By simply passing the mask by value instead of reference, we can avoid the problem completely. On 64-bit architectures, this is also more efficient, while on the less common (at least among ocfs2 users) 32-bit architectures, I'm guessing that the resulting code is comparable to what it was before. The current version was introduced by Joe Perches as an optimization, maybe he can see if my change regresses compared to his. Cc: Joe Perches Fixes: 7c2bd2f930ae ("ocfs2: reduce object size of mlog uses") Signed-off-by: Arnd Bergmann --- fs/ocfs2/cluster/masklog.c | 10 +++++----- fs/ocfs2/cluster/masklog.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c index d331c2386b94..9720c5443e4d 100644 --- a/fs/ocfs2/cluster/masklog.c +++ b/fs/ocfs2/cluster/masklog.c @@ -64,7 +64,7 @@ static ssize_t mlog_mask_store(u64 mask, const char *buf, size_t count) return count; } -void __mlog_printk(const u64 *mask, const char *func, int line, +void __mlog_printk(const u64 mask, const char *func, int line, const char *fmt, ...) { struct va_format vaf; @@ -72,14 +72,14 @@ void __mlog_printk(const u64 *mask, const char *func, int line, const char *level; const char *prefix = ""; - if (!__mlog_test_u64(*mask, mlog_and_bits) || - __mlog_test_u64(*mask, mlog_not_bits)) + if (!__mlog_test_u64(mask, mlog_and_bits) || + __mlog_test_u64(mask, mlog_not_bits)) return; - if (*mask & ML_ERROR) { + if (mask & ML_ERROR) { level = KERN_ERR; prefix = "ERROR: "; - } else if (*mask & ML_NOTICE) { + } else if (mask & ML_NOTICE) { level = KERN_NOTICE; } else { level = KERN_INFO; diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index 308ea0eb35fd..0d0f4bf2c3d8 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h @@ -163,7 +163,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; #endif __printf(4, 5) -void __mlog_printk(const u64 *m, const char *func, int line, +void __mlog_printk(const u64 m, const char *func, int line, const char *fmt, ...); /* @@ -174,7 +174,7 @@ void __mlog_printk(const u64 *m, const char *func, int line, do { \ u64 _m = MLOG_MASK_PREFIX | (mask); \ if (_m & ML_ALLOWED_BITS) \ - __mlog_printk(&_m, __func__, __LINE__, fmt, \ + __mlog_printk(_m, __func__, __LINE__, fmt, \ ##__VA_ARGS__); \ } while (0)