Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1667118rdb; Wed, 20 Sep 2023 16:24:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGu9v1VbnRwjNFO8//YnANK41n4tfj5Bo3dvUGjCRlcGVlue6eDdf5XffZUyE88So/ekKsO X-Received: by 2002:a05:6a20:748b:b0:156:dc22:96a6 with SMTP id p11-20020a056a20748b00b00156dc2296a6mr4391042pzd.55.1695252252416; Wed, 20 Sep 2023 16:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695252252; cv=none; d=google.com; s=arc-20160816; b=srYRqRUe9ulu091sJPIHbJqlDB/h3HUfuGpqJ0Nqrkws/jam/8S93BYtm7EU/mxz9V 4IG+/upVzcESPugEF4GvMDzch0XYs0ufDNCKefYf+SrZt0iTfr8lgVe7Mfa8WUdiDFhB 8/Rkf5CJYrZcw6TUrFRxLzMJOQCdGmeUJ7vd0LnrRVS2o3e8YUQNf1xlKKrzFglqE5IF 73CW1vDGQ2SPwlYUgpauFA3I2XaXhxH0D9OcmpeTiDksXc+Iv7wolJD+9aEHDvGmkzIn ynjemXckDckJxRfxIXxAmxBXDIyDFUhMLv2k8+tAG1Pq0x5H8gDg0tLlBxZVTRKQuPlL GYgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=5mvVkHxDzc75LO4BcLLqzyEg+sz+YO60woTJ/QrfPzs=; fh=a0Ff7e4BX05dslzR8Bd+dcO+oGVODz7AhEkyt0w2WPI=; b=B9fOqXozNv9kKFh1G5D2Kkf8yv2ad9rW2gMdp6w6sF61LePkHEumsEjX4f78DBKACk vS1PI8W7Bujktf6LHRTVeZQmGLx6rkNgrQIhv6aYJq6PIBtjpvAwoy19ZZ5H0uy+jfaq fNIh0kM6ezerGjY9EHzKLkZ29a7exwGEvECod8EQUodZ5Qj6NGThnCdusTfMXQbWZ5AL OYvykc3hdNXNKHd69sAwXJ3LiKBT/N1Xn+ed2+CeK1JidQlvbQGhZ+dhIecMfeg0N4zG 5URuj+DIUr30MahLemxFrN9Hc4QkmXCWnMR8v1RfJJI4oAp2o++SpQLffb64BpBnD3gi fHQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=x9+U0lnT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id b11-20020a170903228b00b001c1f373ea12si133389plh.337.2023.09.20.16.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 16:24:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=x9+U0lnT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 931108091C40; Wed, 20 Sep 2023 14:11:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230213AbjITVLJ (ORCPT + 99 others); Wed, 20 Sep 2023 17:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230053AbjITVLI (ORCPT ); Wed, 20 Sep 2023 17:11:08 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D75BDC9; Wed, 20 Sep 2023 14:11:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=5mvVkHxDzc75LO4BcLLqzyEg+sz+YO60woTJ/QrfPzs=; b=x9+U0lnTN7uFzW8ZVY63lO9a82 Isf1JGhfx/wIb3EUAUfZoXi4xpQG12OHeHUy8PnRKEBhsTfqlBJ0robaURy1dffdphfy2CYX3tjpF A+H/C5R2+O2yyMkwSJ+qGe2CPkgPwn1FrihCkcBQA2uhG1Snd7LjxKwqN/gfZxeFifnztPMmiBoPj vjdMyikJy9YURQI8S7IEGHfaQm6Ggnnl2sOMS28+eFkDg51yer5ST1ween7K/CoIvo0rfHZxbmrxe Nm1fF+1By2vLjqkuU1HT8b/fnHdBRxDBmLKXwu7QoiLZ2MM6nYVPIKo0tGxSznC4MgXne7xSaBWcT Zg2VmFFg==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qj4TJ-004Edi-1f; Wed, 20 Sep 2023 21:10:57 +0000 Date: Wed, 20 Sep 2023 14:10:57 -0700 From: Luis Chamberlain To: Kees Cook Cc: Johan Hovold , Jessica Yu , Sagi Grimberg , Nick Desaulniers , Miguel Ojeda , Joe Perches , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] module: Clarify documentation of module_param_call() Message-ID: References: <20230913235407.gonna.817-kees@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230913235407.gonna.817-kees@kernel.org> Sender: Luis Chamberlain X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 20 Sep 2023 14:11:07 -0700 (PDT) On Wed, Sep 13, 2023 at 04:54:14PM -0700, Kees Cook wrote: > Commit 9bbb9e5a3310 ("param: use ops in struct kernel_param, rather than > get and set fns directly") added the comment that module_param_call() > was deprecated, during a large scale refactoring to bring sanity to type > casting back then. In 2017 following more cleanups, it became useful > again as it wraps a common pattern of creating an ops struct for a > given get/set pair: > > b2f270e87473 ("module: Prepare to convert all module_param_call() prototypes") > ece1996a21ee ("module: Do not paper over type mismatches in module_param_call()") > > static const struct kernel_param_ops __param_ops_##name = \ > { .flags = 0, .set = _set, .get = _get }; \ > __module_param_call(MODULE_PARAM_PREFIX, \ > name, &__param_ops_##name, arg, perm, -1, 0) > > __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0) > > Many users of module_param_cb() appear to be almost universally > open-coding the same thing that module_param_call() does now. Don't > discourage[1] people from using module_param_call(): clarify the comment > to show that module_param_cb() is useful if you repeatedly use the same > pair of get/set functions. > > [1] https://lore.kernel.org/lkml/202308301546.5C789E5EC@keescook/ > > Cc: Luis Chamberlain > Cc: Johan Hovold > Cc: Jessica Yu > Cc: Sagi Grimberg > Cc: Nick Desaulniers > Cc: Miguel Ojeda > Cc: Joe Perches > Cc: linux-modules@vger.kernel.org > Reviewed-by: Miguel Ojeda > Signed-off-by: Kees Cook Applied and pushed to modules-next, thanks > --- > Luis, I note that include/linux/moduleparam.h isn't in the MAINTAINERS > file pattern. Perhaps you want to use include/linux/module*.h? Sent patch! Thanks! Luis