From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7168C41604 for ; Sun, 4 Oct 2020 02:11:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2FB062065E for ; Sun, 4 Oct 2020 02:11:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FB062065E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 528636B005D; Sat, 3 Oct 2020 22:11:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D9A88E0001; Sat, 3 Oct 2020 22:11:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EFEB6B0068; Sat, 3 Oct 2020 22:11:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0218.hostedemail.com [216.40.44.218]) by kanga.kvack.org (Postfix) with ESMTP id 0F0C16B005D for ; Sat, 3 Oct 2020 22:11:36 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B0C353630 for ; Sun, 4 Oct 2020 02:11:35 +0000 (UTC) X-FDA: 77332616550.05.books57_2d07a7e271b1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 9A3B018017519 for ; Sun, 4 Oct 2020 02:11:35 +0000 (UTC) X-HE-Tag: books57_2d07a7e271b1 X-Filterd-Recvd-Size: 5046 Received: from smtprelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Sun, 4 Oct 2020 02:11:35 +0000 (UTC) Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id 0132A100E7B43; Sun, 4 Oct 2020 02:11:35 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: soap16_3903463271b1 X-Filterd-Recvd-Size: 3708 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA; Sun, 4 Oct 2020 02:11:33 +0000 (UTC) Message-ID: <9541b95e9b36e606d62174aa46ec8265f36652d6.camel@perches.com> Subject: Re: Where is the declaration of buffer used in kernel_param_ops .get functions? From: Joe Perches To: Matthew Wilcox Cc: Greg KH , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, rcu@vger.kernel.org, linux-mm@kvack.org Date: Sat, 03 Oct 2020 19:11:30 -0700 In-Reply-To: <20201004013626.GE20115@casper.infradead.org> References: <250919192de237dadf36218ee6b4dabf1bd4cbde.camel@perches.com> <20201004013626.GE20115@casper.infradead.org> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sun, 2020-10-04 at 02:36 +0100, Matthew Wilcox wrote: > On Sat, Oct 03, 2020 at 06:19:18PM -0700, Joe Perches wrote: > > These patches came up because I was looking for > > the location of the declaration of the buffer used > > in kernel/params.c struct kernel_param_ops .get > > functions. > > > > I didn't find it. > > > > I want to see if it's appropriate to convert the > > sprintf family of functions used in these .get > > functions to sysfs_emit. > > > > Patches submitted here: > > https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/ > > > > Anyone know if it's appropriate to change the > > sprintf-like uses in these functions to sysfs_emit > > and/or sysfs_emit_at? > > There's a lot of preprocessor magic to wade through. > > I'm pretty sure this comes through include/linux/moduleparam.h > and kernel/module.c. Dunno, looked there, still can't find it. btw: The __module_param_call macro looks very dodgy as it uses both __used and __attribute__((unused)) and likely one of them should be removed (unused?) It looks like the comes from varying definitions of __attribute_used__ eventually converted to __used for old gcc versions 2, 3, and 4. 1da177e4c3f4:include/linux/compiler-gcc2.h:#define __attribute_used__ __attribute__((__unused__)) 1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__used__)) 1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__unused__)) 1da177e4c3f4:include/linux/compiler-gcc4.h:#define __attribute_used__ __attribute__((__used__)) Maybe: --- include/linux/moduleparam.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 47879fc7f75e..fc820b27fb00 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -288,10 +288,10 @@ struct kparam_array /* Default value instead of permissions? */ \ static const char __param_str_##name[] = prefix #name; \ static struct kernel_param __moduleparam_const __param_##name \ - __used \ - __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ - = { __param_str_##name, THIS_MODULE, ops, \ - VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } } + __used __section("__param") __aligned(sizeof(void *)) = { \ + __param_str_##name, THIS_MODULE, ops, \ + VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } \ + } /* Obsolete - use module_param_cb() */ #define module_param_call(name, _set, _get, arg, perm) \