From nobody Tue Apr 7 11:17:23 2026 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFD9637F013 for ; Fri, 13 Mar 2026 13:49:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773409789; cv=none; b=ESllQOFD8VPiTSiH/gK/U2Y6RbFqICiC8g/QLcIHUAo14CKaNCJKMDalPWxQKzUWvXiPNMHmD44qCkm4n/wQs55X2dWmBLzSVTyCWjabNUL7zu71kUAwIZjI03Am/tZnnZT0Zjwd+Yw+XmX4tUxVLJnKh8JbNEn43vVVEmgYgb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773409789; c=relaxed/simple; bh=Nsioy69ENiyic8NlC9zA1Y5+vGS4n4oQxZyAscxrrBA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ukacXBiIFZ/IkksRr1KNWUQ6DqZ7lklQiwiAlCaH1FE3AyQMduhef37NEA2cRbPtToTHG1sXbY5lNF0wa1skWWSkfyHAegJ4QP0RmLhF4La5j/LUuvOd+mQHz9nhomVBPUvz6PCoX3YSzsjWtSKtFO09WRLCgLpOQFUa4j3KWy4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=TXVDeauq; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="TXVDeauq" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4853c3c2fe7so13252415e9.0 for ; Fri, 13 Mar 2026 06:49:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773409786; x=1774014586; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E/U2+H20h/nJ9Ad48rWk+9dOJeC/jWCnSXA0zRNJUBE=; b=TXVDeauqu2kJMAJQgJDGpU+EJDsYa6TZPOxk8OEXYB3bMhT0Xeu1IXeq0bWyzv2mi0 A9g1XEeS4NSPRcS3L1nDN1L9XuutbGh0Na2yp+ap3BVLWyHzXbOgjio1+LdAUN5KwL5D P+kgT7WwHNO/uIBcRKAnDPiyocofBkWxdYvHoagT9TN0E984S3njOhDdPFofkGbbjk2H iSIX64pAfj0dT6LRQBhkLzXWmchjRMbRwiH6Lcv4Hc962YaG/QZrc6ua/2a8w4kpxKCn v77YoN6YpIXuzJJnU+7nn2GCdMPftXTlmyH2V5dUj5w5YLYwFTPLidQGlRh0/AizBtex Z6xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773409786; x=1774014586; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=E/U2+H20h/nJ9Ad48rWk+9dOJeC/jWCnSXA0zRNJUBE=; b=cBFU12IZz6NiEMU4mKFZ+nY436NYhFDQv3RplJg+CBepoGupOEwNZKnpRDXAR5lW9y gXr4aGI18sTqCF7N+CQFrq6Ml3WRG0fW2zDdSWyVZFjKoYM5yvFUXaS2H8YBCt7szg4y tGuV1umVD2eMLbbbkHzdU39Kd/QRleNpa7reZWnnxpMyCe1A2+xYn2I+nHXlyw7LbHNj ptkG5HIef/GO2MhqoSMmqe1hwrXZuQkrsMQpzOKW5r8j4lUky0RfL9xFJO23bLcuZvFk KgfYpbj74qTAE7pP/T2tJwaj3xLi0eE77iKveTeOshO+NM52WBWeoEtvzWj8ymPCH6B3 ZOVA== X-Forwarded-Encrypted: i=1; AJvYcCUH+W/rEQYO7QF6Hp+g9FMqSQUhQnD/sgn+ct1qBRpeXi8ivOTTfWHVe9fJl1LZ5vq1aRhtmXO/x5ysjqY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw8pMPGC+wXyaDEsajkK6BlwdLTx1tPtvgrri4GxXOJXyyMkl5/ X1uiO4nD22TEe2V1oEUuPyIvOTiV8//xUq9CNcwdEFXpjBcRDjT86TQdzqaRuKqpPB4= X-Gm-Gg: ATEYQzzcJgMiTp+qA/+K0NLO+is7B/ppCST2cz/l6JDiUKjkSiL5RNt0/APZbZHtxFo NqyF9/DvBZbIqnL08UtQDEcou8kKGFU7rBG2PTvlUshW6yVDMvye1JiFF5xvuhW4H8v6E0mdFVi KO3XsLtEipU3n8nW5bpr0NblfZnCdtsbmdSKPr/tKp2/ZJ4lVVfAbgj4fuVLRrWO4QSZxa66B9f PU24SgwFS5vR30KE9MbmOs5tDl3Ai3Vxa3DCUij1GmzBUX70T1x9QrkPVkIMGc7vZlBfM2yweC/ zmIUikKruZNG7vKAqNPRG/8OT0qn/nXfDG6nyCQ0/I+YAcvaWl8wulKavDxDlXDvjjp9bfn49kc T0omDmBVvCdFStrBbB5fwNt3INrNaUVQTtAoyjtxluWINY7MKfesbsvaxDFIMk5RHR13zJ6OkKy O3g9ACj5V4XX7RmhadoEDB2/jfPdKtOr7stK7Xe6lp X-Received: by 2002:a05:600c:4f8b:b0:485:3e6c:aa84 with SMTP id 5b1f17b1804b1-4855670f7d3mr50278125e9.33.1773409785931; Fri, 13 Mar 2026 06:49:45 -0700 (PDT) Received: from zovi.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854b66e3f8sm206491865e9.14.2026.03.13.06.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 06:49:45 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Christophe Leroy , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] module: Fix freeing of charp module parameters when CONFIG_SYSFS=n Date: Fri, 13 Mar 2026 14:48:02 +0100 Message-ID: <20260313134932.335275-2-petr.pavlu@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260313134932.335275-1-petr.pavlu@suse.com> References: <20260313134932.335275-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When setting a charp module parameter, the param_set_charp() function allocates memory to store a copy of the input value. Later, when the module is potentially unloaded, the destroy_params() function is called to free this allocated memory. However, destroy_params() is available only when CONFIG_SYSFS=3Dy, otherwise only a dummy variant is present. In the unlikely case that the kernel is configured with CONFIG_MODULES=3Dy and CONFIG_SYSFS=3Dn, this results in a memory leak of charp values when a module is unloaded. Fix this issue by making destroy_params() always available when CONFIG_MODULES=3Dy. Rename the function to module_destroy_params() to clari= fy that it is intended for use by the module loader. Fixes: e180a6b7759a ("param: fix charp parameters set via sysfs") Signed-off-by: Petr Pavlu --- include/linux/moduleparam.h | 11 +++-------- kernel/module/main.c | 4 ++-- kernel/params.c | 27 ++++++++++++++++++--------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 7d22d4c4ea2e..8667f72503d9 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -426,14 +426,9 @@ extern char *parse_args(const char *name, void *arg, parse_unknown_fn unknown); =20 /* Called by module remove. */ -#ifdef CONFIG_SYSFS -extern void destroy_params(const struct kernel_param *params, unsigned num= ); -#else -static inline void destroy_params(const struct kernel_param *params, - unsigned num) -{ -} -#endif /* !CONFIG_SYSFS */ +#ifdef CONFIG_MODULES +void module_destroy_params(const struct kernel_param *params, unsigned int= num); +#endif =20 /* All the helper functions */ /* The macros to do compile-time type checking stolen from Jakub diff --git a/kernel/module/main.c b/kernel/module/main.c index c3ce106c70af..ef2e2130972f 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -1408,7 +1408,7 @@ static void free_module(struct module *mod) module_unload_free(mod); =20 /* Free any allocated parameters. */ - destroy_params(mod->kp, mod->num_kp); + module_destroy_params(mod->kp, mod->num_kp); =20 if (is_livepatch_module(mod)) free_module_elf(mod); @@ -3519,7 +3519,7 @@ static int load_module(struct load_info *info, const = char __user *uargs, mod_sysfs_teardown(mod); coming_cleanup: mod->state =3D MODULE_STATE_GOING; - destroy_params(mod->kp, mod->num_kp); + module_destroy_params(mod->kp, mod->num_kp); blocking_notifier_call_chain(&module_notify_list, MODULE_STATE_GOING, mod); klp_module_going(mod); diff --git a/kernel/params.c b/kernel/params.c index 7188a12dbe86..c6a354d54213 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -745,15 +745,6 @@ void module_param_sysfs_remove(struct module *mod) } #endif =20 -void destroy_params(const struct kernel_param *params, unsigned num) -{ - unsigned int i; - - for (i =3D 0; i < num; i++) - if (params[i].ops->free) - params[i].ops->free(params[i].arg); -} - struct module_kobject * __init_or_module lookup_or_create_module_kobject(const char *name) { @@ -985,3 +976,21 @@ static int __init param_sysfs_builtin_init(void) late_initcall(param_sysfs_builtin_init); =20 #endif /* CONFIG_SYSFS */ + +#ifdef CONFIG_MODULES + +/* + * module_destroy_params - free all parameters for one module + * @params: module parameters (array) + * @num: number of module parameters + */ +void module_destroy_params(const struct kernel_param *params, unsigned int= num) +{ + unsigned int i; + + for (i =3D 0; i < num; i++) + if (params[i].ops->free) + params[i].ops->free(params[i].arg); +} + +#endif /* CONFIG_MODULES */ --=20 2.53.0 From nobody Tue Apr 7 11:17:23 2026 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C4CC39182D for ; Fri, 13 Mar 2026 13:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773409790; cv=none; b=t7FTUbfCbESPIL6qmcDR73k6AXUsDtcMAWz9Wv31r1Cuifesi3qMg3th3jeteek/kJNuO4IgIWodthalkuVFTnHTZZ4CNW7k1hbCm2eIS554ELIUfijrdIw2nZlotObG7S0NyHgV3xhdwjKsGfDLTIXY4tFonyD6MOhoHLbrg9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773409790; c=relaxed/simple; bh=xlmQ3qDMzvpdpMifhJ6Anh93+euqAxMJmpGAKMOuu10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c017MOGTEICrIlMvOb8VdnmLs/HajAPG99gQtRplk2Dn3BixwIxuwoKnr0a4d1DgukzytLoG96Dz1a2VafSjqq7BeJ+WQgMA2GKBBhw32XSyMqA3CSp0UGVqyRCNeLJZvreaO+U4x3rUUXcsXnwVZhHtgYHt6w/03yVl3LXKZ70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=daEi+si5; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="daEi+si5" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-48374014a77so22211665e9.3 for ; Fri, 13 Mar 2026 06:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773409787; x=1774014587; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bphY2YyBdum7UF8/btyrmh1KWiawcs+qdIGEesKpiDc=; b=daEi+si5DbjIfVaZnxFP/K7boJiUh+S6V2CrJfs2AN9j2fZWgpA9QXQq4GhZNQJQxp e9eB+1FoDTP9TpvVpn1egWOzoS+R40q01Tif0pMv9rfQDLCGUWgcM48AVkfC00WgYcSQ maMkmek94TU9JREfa77InS4V2p9kj16n07Mx2vHGOz12S30NyqnZ3H9/W3yI5oXJQEpO UFwDZf1HYFvRUacTXcPbZPl4nzDUu2JPZuvER0kGRDHv5KN5PiCVBwwbhmVb5FwpE6oU 3XMkg4DRgEfZIzgz+1HiwAggAlhaxPtwWprhDTmITxb2SwZeIGs4cRiqJaB8JMSWCAHi vIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773409787; x=1774014587; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=bphY2YyBdum7UF8/btyrmh1KWiawcs+qdIGEesKpiDc=; b=gH9gTC+nWsmwr2+gZu8HkLRzSoJ8npUec8ZOWEJI6i3rcnZCoo7Sol2gzXMFguEERo Aeip3A9l2++5cI4eNTpHqR69f2D0Wy+OTYtlxL84r0FHQ1qq88rAU1nS/tigM9164VNv o3eFmxor+zV6O5APm1eXLEWdjOxbogyvc51dxnfiloTSjBPGh8tHVxc846nq0X+79Fba IuQK5l+KzalBetq3KBPC8WPSfp4Mt392j00puGG2eNEM722uFGE4r5PT75rnZ0Mi4Wg/ /qhdQT9t32zQ9blcgoGsh3Yg8gtYTbj8m5+LIGUABg1ku9u8krqiVfsccrKCYLD0Qmz/ KuFQ== X-Forwarded-Encrypted: i=1; AJvYcCUStEKW81A5KQD6qMFwnQ06xo7IYuCx1WcGQqk9Xx/g4+Q6nppB98z1xd6cc+GrNINkdc55HGKEI/TCbFo=@vger.kernel.org X-Gm-Message-State: AOJu0YwDWEOWONfRA6x2+0iAAZo/BTqWrbd5vKQf0gXdzeqvUhLy3NcW 7o1JEJS8MG9BbfbG0oV/1MbdNop+a25UwUS9RcAtPjncOIv9fUjgPIdhogYqjy3vaRQ= X-Gm-Gg: ATEYQzx8pSPPs911w/Vag982PsOGRddmIJvF30IBkj8wIN+zhJd+wX//S5uYuDMJ4bY Pja61D3aMK2VRCg/F611BO5G7Z1kHI3dSHc3hsGiUgReOSlqYu1uvqffEeWdrro80trSSLUHPgC +NyeOBQMPVTXn7MIthnShjqprxaNGG23HT3GbC7U0YeV8kI9gx2sU+mKzOD2pmpWslkcLnxSkfi 2RmLzPjZAIuY7GIoWXKQJYBCReX/sy6/ileylfEsneE1ezPqN5dq7atyRVJuloWcQ9lVnsKUspl 3nkO1Wzh+lkhQ3wrNPiMU3y118Z99fsXdhVKCgY2rGq66Fpl9Tt1HSaEVKKsX+dJKfnPzrX3SzP Sa/PH44sEDUgbYYp5ahuQyj5EO+zU1MFo4D48Uqej2oqZ0VmJxbnK+7qXiPU38CUox9W6Fh0L3P 8Rc7MYrWO407rJsSYVc4O83cZ8r6qnx9TqNZg4YkLu X-Received: by 2002:a05:600c:8b6a:b0:485:40c6:f528 with SMTP id 5b1f17b1804b1-48556711e74mr53911955e9.30.1773409786636; Fri, 13 Mar 2026 06:49:46 -0700 (PDT) Received: from zovi.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854b66e3f8sm206491865e9.14.2026.03.13.06.49.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 06:49:46 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Christophe Leroy , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/3] module: Clean up parse_args() arguments Date: Fri, 13 Mar 2026 14:48:03 +0100 Message-ID: <20260313134932.335275-3-petr.pavlu@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260313134932.335275-1-petr.pavlu@suse.com> References: <20260313134932.335275-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" * Use the preferred `unsigned int` over plain `unsigned` for the `num` parameter. * Synchronize the parameter names in moduleparam.h with the ones used by the implementation in params.c. Signed-off-by: Petr Pavlu --- include/linux/moduleparam.h | 8 ++++---- kernel/params.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 8667f72503d9..604bc6e9f3a1 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -417,12 +417,12 @@ extern bool parameqn(const char *name1, const char *n= ame2, size_t n); typedef int (*parse_unknown_fn)(char *param, char *val, const char *doing,= void *arg); =20 /* Called on module insert or kernel boot */ -extern char *parse_args(const char *name, +extern char *parse_args(const char *doing, char *args, const struct kernel_param *params, - unsigned num, - s16 level_min, - s16 level_max, + unsigned int num, + s16 min_level, + s16 max_level, void *arg, parse_unknown_fn unknown); =20 /* Called by module remove. */ diff --git a/kernel/params.c b/kernel/params.c index c6a354d54213..74d620bc2521 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -161,7 +161,7 @@ static int parse_one(char *param, char *parse_args(const char *doing, char *args, const struct kernel_param *params, - unsigned num, + unsigned int num, s16 min_level, s16 max_level, void *arg, parse_unknown_fn unknown) --=20 2.53.0 From nobody Tue Apr 7 11:17:23 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 327933947B4 for ; Fri, 13 Mar 2026 13:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773409791; cv=none; b=t3aNhAmCL0sBwo3qWkWgseRy4t6YlBUBW63C91T/dyOnsUZ0Kkl0dCiQ3ScLtGCpnE3SmrhnX9raniDZFCdeq0JD3cnn9vfDpbsPZQIFAJR3wTftXyFRegfGQLcTyl5F4XFXSjVkN3zXbM3JUBJgq3klbh6i/G1Qd0xbAReMv8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773409791; c=relaxed/simple; bh=qruJx6QJEICr8bcneKcKb3mtFa1KqnHncYpYtjLmF5k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rbATgxOmHJ2vv1lw5DBo5XepyQ4b5DVtaoHvSDrGt7+2sFTKWNs0E0k8LMvwC6K2FjJNKlYEqKJwR/SUd7kutBWwhOXLhYvaNrqKcB5CRt2hhg/3YIjf60r8OgU1tzM7JSsEk6ciNe3SihT95u0+4r+J+Rz6y6w+sfTcgeU3IOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=TZEnpjWv; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="TZEnpjWv" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-48535a0ef86so18388165e9.1 for ; Fri, 13 Mar 2026 06:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1773409787; x=1774014587; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VGEtKP4Tr+bgxoNWP/aiQM4tyqyPY7Jg/v7bcyDwq6Y=; b=TZEnpjWvwF6duicvrRlAYvuTw2tYpLZaeuwBaSwQiuBsqdXAYCUQ9HOvN0xx7jccEN 6uLUOuGONLudTigIEXxX8vOsaHdB6AgqLxYV+FtYoYac0SqYM6PrkUNiDYzpUzVm09hi odR88dJ6kifIf/q4G2cGtk2ojnshlwwxmwAPkozLY8qzsu+8pID1Nyoh+D7cG/AyeqST 1XFKnDwNTwpZMNRVn6xfTPV2vF3zfdjuutETDWbCBktxlAL3B1RX1w9GTaOS9tIUqu6G MSmunzu/FGdJ7eAdhfw7YESrB5H9z58e2RK/bNnUk/zCfivV3LGtF/sfQ6ve4H7TcJiq znpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773409787; x=1774014587; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VGEtKP4Tr+bgxoNWP/aiQM4tyqyPY7Jg/v7bcyDwq6Y=; b=qnzMqZGIm/+iYQzI2JIjdXIt8orVzyZYwoThc7bNnRGnVeIQgBNDySD8RPIke8qKCm sER0dDyhLOqKtGSsYESIq3hPDfzmK1px1NecZh9R5fHp8PTsv9stsFpIodOjfCFAq6SU Snex7YkfogENjxXo8GovZQImbO/+zYFbQX6u89tBqgj5bjqDxRsDsg7HrqHvaQF6hYkt mITajtxZszWH215eTsXs2sj+C7Zxnor2bTIA5+lrWnumqGrAe0zrd59W2m16FAbBhJQf REv4dZgLy7BRN4K2pCZoNsK1SZnnsKpdxSi82K65fTiwZn3eNpfZzbtBD1UAwsj8qrA1 E9Cw== X-Forwarded-Encrypted: i=1; AJvYcCVB4K/XLB4lBjK1e4RwpGx97dRA668f66ZbcWGyYwXFImWuKY3ZhBPdTE04nmvs3dUUYXhQPeSed1fBLlc=@vger.kernel.org X-Gm-Message-State: AOJu0Yzoy3geWN9TnfBYFoPV15nbSBPCpH75Zrz/JDmrJYJSyuBG303E 8bCjvos7UI9rl00jS0IhJsV7+v3bNWMQYY6okj4Zb6bu9qc6lfsiBoMFjWDbCHBoS04= X-Gm-Gg: ATEYQzwQgfyfVBDPR2Dv2a2RU6NX/ka3gNzB1gzWQ2MKbQPqgOWuKD/r8UIVMK9fSxu HihDOCAHL2cohELk589kfvmDe9qwdNunul8IYmVKVeD3W7F26kQeBIhjvrxyTIT6PF6JtHQ8OXP tWY1aCgdIECmRk3C+aD+Ia7LYvVaOtbbEecWjLbsyUaAEY/JQDlg6Mt+EEpRRVtbMmn4r0CYYhp 9rDqThsLPF4giTmOXWMXKH9WLwgOKQPJTn6tAR4jzcWAuoFEr98eYCZrVxS9FllxHIx6B3aE9t0 JmG9RrljEYiS9qSjIapvOIg3W9kniP8fjd7VLKN7TvjJ5zOLJbs1+RIR+f6jFlmERwRnnNhHc6S jDG5rwpIPm/mUqB4BCw49JC+HrOPPs64VWadzXDh1DLLzH0eqvhvp/LySjcopyCBTlQyJ4z+wQN I83Vvo32gGTN43IahAhpscBCho+e7Wlt2ptGHz6wHh X-Received: by 2002:a05:600c:8b6f:b0:477:5c58:3d42 with SMTP id 5b1f17b1804b1-485566d92f3mr54669825e9.10.1773409787280; Fri, 13 Mar 2026 06:49:47 -0700 (PDT) Received: from zovi.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4854b66e3f8sm206491865e9.14.2026.03.13.06.49.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2026 06:49:47 -0700 (PDT) From: Petr Pavlu To: Luis Chamberlain , Petr Pavlu , Daniel Gomez , Sami Tolvanen Cc: Christophe Leroy , Aaron Tomlin , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] module: Remove extern keyword from param prototypes Date: Fri, 13 Mar 2026 14:48:04 +0100 Message-ID: <20260313134932.335275-4-petr.pavlu@suse.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260313134932.335275-1-petr.pavlu@suse.com> References: <20260313134932.335275-1-petr.pavlu@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The external function declarations do not need the "extern" keyword. Remove it to align with the Linux kernel coding style and to silence the associated checkpatch warnings. Signed-off-by: Petr Pavlu --- include/linux/moduleparam.h | 89 ++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 45 deletions(-) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 604bc6e9f3a1..075f28585074 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -317,8 +317,8 @@ struct kparam_array name, &__param_ops_##name, arg, perm, -1, 0) =20 #ifdef CONFIG_SYSFS -extern void kernel_param_lock(struct module *mod); -extern void kernel_param_unlock(struct module *mod); +void kernel_param_lock(struct module *mod); +void kernel_param_unlock(struct module *mod); #else static inline void kernel_param_lock(struct module *mod) { @@ -398,7 +398,7 @@ static inline void kernel_param_unlock(struct module *m= od) * Returns: true if the two parameter names are equal. * Dashes (-) are considered equal to underscores (_). */ -extern bool parameq(const char *name1, const char *name2); +bool parameq(const char *name1, const char *name2); =20 /** * parameqn - checks if two parameter names match @@ -412,18 +412,18 @@ extern bool parameq(const char *name1, const char *na= me2); * are equal. * Dashes (-) are considered equal to underscores (_). */ -extern bool parameqn(const char *name1, const char *name2, size_t n); +bool parameqn(const char *name1, const char *name2, size_t n); =20 typedef int (*parse_unknown_fn)(char *param, char *val, const char *doing,= void *arg); =20 /* Called on module insert or kernel boot */ -extern char *parse_args(const char *doing, - char *args, - const struct kernel_param *params, - unsigned int num, - s16 min_level, - s16 max_level, - void *arg, parse_unknown_fn unknown); +char *parse_args(const char *doing, + char *args, + const struct kernel_param *params, + unsigned int num, + s16 min_level, + s16 max_level, + void *arg, parse_unknown_fn unknown); =20 /* Called by module remove. */ #ifdef CONFIG_MODULES @@ -437,78 +437,77 @@ void module_destroy_params(const struct kernel_param = *params, unsigned int num); static inline type __always_unused *__check_##name(void) { return(p); } =20 extern const struct kernel_param_ops param_ops_byte; -extern int param_set_byte(const char *val, const struct kernel_param *kp); -extern int param_get_byte(char *buffer, const struct kernel_param *kp); +int param_set_byte(const char *val, const struct kernel_param *kp); +int param_get_byte(char *buffer, const struct kernel_param *kp); #define param_check_byte(name, p) __param_check(name, p, unsigned char) =20 extern const struct kernel_param_ops param_ops_short; -extern int param_set_short(const char *val, const struct kernel_param *kp); -extern int param_get_short(char *buffer, const struct kernel_param *kp); +int param_set_short(const char *val, const struct kernel_param *kp); +int param_get_short(char *buffer, const struct kernel_param *kp); #define param_check_short(name, p) __param_check(name, p, short) =20 extern const struct kernel_param_ops param_ops_ushort; -extern int param_set_ushort(const char *val, const struct kernel_param *kp= ); -extern int param_get_ushort(char *buffer, const struct kernel_param *kp); +int param_set_ushort(const char *val, const struct kernel_param *kp); +int param_get_ushort(char *buffer, const struct kernel_param *kp); #define param_check_ushort(name, p) __param_check(name, p, unsigned short) =20 extern const struct kernel_param_ops param_ops_int; -extern int param_set_int(const char *val, const struct kernel_param *kp); -extern int param_get_int(char *buffer, const struct kernel_param *kp); +int param_set_int(const char *val, const struct kernel_param *kp); +int param_get_int(char *buffer, const struct kernel_param *kp); #define param_check_int(name, p) __param_check(name, p, int) =20 extern const struct kernel_param_ops param_ops_uint; -extern int param_set_uint(const char *val, const struct kernel_param *kp); -extern int param_get_uint(char *buffer, const struct kernel_param *kp); +int param_set_uint(const char *val, const struct kernel_param *kp); +int param_get_uint(char *buffer, const struct kernel_param *kp); int param_set_uint_minmax(const char *val, const struct kernel_param *kp, unsigned int min, unsigned int max); #define param_check_uint(name, p) __param_check(name, p, unsigned int) =20 extern const struct kernel_param_ops param_ops_long; -extern int param_set_long(const char *val, const struct kernel_param *kp); -extern int param_get_long(char *buffer, const struct kernel_param *kp); +int param_set_long(const char *val, const struct kernel_param *kp); +int param_get_long(char *buffer, const struct kernel_param *kp); #define param_check_long(name, p) __param_check(name, p, long) =20 extern const struct kernel_param_ops param_ops_ulong; -extern int param_set_ulong(const char *val, const struct kernel_param *kp); -extern int param_get_ulong(char *buffer, const struct kernel_param *kp); +int param_set_ulong(const char *val, const struct kernel_param *kp); +int param_get_ulong(char *buffer, const struct kernel_param *kp); #define param_check_ulong(name, p) __param_check(name, p, unsigned long) =20 extern const struct kernel_param_ops param_ops_ullong; -extern int param_set_ullong(const char *val, const struct kernel_param *kp= ); -extern int param_get_ullong(char *buffer, const struct kernel_param *kp); +int param_set_ullong(const char *val, const struct kernel_param *kp); +int param_get_ullong(char *buffer, const struct kernel_param *kp); #define param_check_ullong(name, p) __param_check(name, p, unsigned long l= ong) =20 extern const struct kernel_param_ops param_ops_hexint; -extern int param_set_hexint(const char *val, const struct kernel_param *kp= ); -extern int param_get_hexint(char *buffer, const struct kernel_param *kp); +int param_set_hexint(const char *val, const struct kernel_param *kp); +int param_get_hexint(char *buffer, const struct kernel_param *kp); #define param_check_hexint(name, p) param_check_uint(name, p) =20 extern const struct kernel_param_ops param_ops_charp; -extern int param_set_charp(const char *val, const struct kernel_param *kp); -extern int param_get_charp(char *buffer, const struct kernel_param *kp); -extern void param_free_charp(void *arg); +int param_set_charp(const char *val, const struct kernel_param *kp); +int param_get_charp(char *buffer, const struct kernel_param *kp); +void param_free_charp(void *arg); #define param_check_charp(name, p) __param_check(name, p, char *) =20 /* We used to allow int as well as bool. We're taking that away! */ extern const struct kernel_param_ops param_ops_bool; -extern int param_set_bool(const char *val, const struct kernel_param *kp); -extern int param_get_bool(char *buffer, const struct kernel_param *kp); +int param_set_bool(const char *val, const struct kernel_param *kp); +int param_get_bool(char *buffer, const struct kernel_param *kp); #define param_check_bool(name, p) __param_check(name, p, bool) =20 extern const struct kernel_param_ops param_ops_bool_enable_only; -extern int param_set_bool_enable_only(const char *val, - const struct kernel_param *kp); +int param_set_bool_enable_only(const char *val, const struct kernel_param = *kp); /* getter is the same as for the regular bool */ #define param_check_bool_enable_only param_check_bool =20 extern const struct kernel_param_ops param_ops_invbool; -extern int param_set_invbool(const char *val, const struct kernel_param *k= p); -extern int param_get_invbool(char *buffer, const struct kernel_param *kp); +int param_set_invbool(const char *val, const struct kernel_param *kp); +int param_get_invbool(char *buffer, const struct kernel_param *kp); #define param_check_invbool(name, p) __param_check(name, p, bool) =20 /* An int, which can only be set like a bool (though it shows as an int). = */ extern const struct kernel_param_ops param_ops_bint; -extern int param_set_bint(const char *val, const struct kernel_param *kp); +int param_set_bint(const char *val, const struct kernel_param *kp); #define param_get_bint param_get_int #define param_check_bint param_check_int =20 @@ -615,19 +614,19 @@ enum hwparam_type { extern const struct kernel_param_ops param_array_ops; =20 extern const struct kernel_param_ops param_ops_string; -extern int param_set_copystring(const char *val, const struct kernel_param= *); -extern int param_get_string(char *buffer, const struct kernel_param *kp); +int param_set_copystring(const char *val, const struct kernel_param *kp); +int param_get_string(char *buffer, const struct kernel_param *kp); =20 /* for exporting parameters in /sys/module/.../parameters */ =20 struct module; =20 #if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES) -extern int module_param_sysfs_setup(struct module *mod, - const struct kernel_param *kparam, - unsigned int num_params); +int module_param_sysfs_setup(struct module *mod, + const struct kernel_param *kparam, + unsigned int num_params); =20 -extern void module_param_sysfs_remove(struct module *mod); +void module_param_sysfs_remove(struct module *mod); #else static inline int module_param_sysfs_setup(struct module *mod, const struct kernel_param *kparam, --=20 2.53.0