netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: netconsole: Constify struct config_item_type
@ 2024-08-10 21:39 Christophe JAILLET
  2024-08-13 10:46 ` Breno Leitao
  2024-08-14  2:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2024-08-10 21:39 UTC (permalink / raw)
  To: Breno Leitao, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

'struct config_item_type' is not modified in this driver.

This structure is only used with config_group_init_type_name() which takes
a const struct config_item_type* as a 3rd argument.

This also makes things consistent with 'netconsole_target_type' witch is
already const.

Constifying this structure moves some data to a read-only section, so
increase overall security, especially when the structure holds some
function pointers.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  33007	   3952	   1312	  38271	   957f	drivers/net/netconsole.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  33071	   3888	   1312	  38271	   957f	drivers/net/netconsole.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only.
---
 drivers/net/netconsole.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index ffedf7648bed..48b309e0a93a 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -778,7 +778,7 @@ static struct configfs_group_operations userdata_ops = {
 	.drop_item		= userdatum_drop,
 };
 
-static struct config_item_type userdata_type = {
+static const struct config_item_type userdata_type = {
 	.ct_item_ops	= &userdatum_ops,
 	.ct_group_ops	= &userdata_ops,
 	.ct_attrs	= userdata_attrs,
-- 
2.46.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: netconsole: Constify struct config_item_type
  2024-08-10 21:39 [PATCH net-next] net: netconsole: Constify struct config_item_type Christophe JAILLET
@ 2024-08-13 10:46 ` Breno Leitao
  2024-08-14  2:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Breno Leitao @ 2024-08-13 10:46 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	linux-kernel, kernel-janitors, netdev

Hello Christophe,

On Sat, Aug 10, 2024 at 11:39:04PM +0200, Christophe JAILLET wrote:
> 'struct config_item_type' is not modified in this driver.
> 
> This structure is only used with config_group_init_type_name() which takes
> a const struct config_item_type* as a 3rd argument.
> 
> This also makes things consistent with 'netconsole_target_type' witch is
> already const.
> 
> Constifying this structure moves some data to a read-only section, so
> increase overall security, especially when the structure holds some
> function pointers.
> 
> On a x86_64, with allmodconfig:
> Before:
> ======
>    text	   data	    bss	    dec	    hex	filename
>   33007	   3952	   1312	  38271	   957f	drivers/net/netconsole.o
> 
> After:
> =====
>    text	   data	    bss	    dec	    hex	filename
>   33071	   3888	   1312	  38271	   957f	drivers/net/netconsole.o
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Breno Leitao <leitao@debian.org>

> Compile tested-only.

I've tested it using a selftime I am creating, and it is all good.

Thanks for the patch!
--breno

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: netconsole: Constify struct config_item_type
  2024-08-10 21:39 [PATCH net-next] net: netconsole: Constify struct config_item_type Christophe JAILLET
  2024-08-13 10:46 ` Breno Leitao
@ 2024-08-14  2:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-14  2:30 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: leitao, davem, edumazet, kuba, pabeni, linux-kernel,
	kernel-janitors, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 10 Aug 2024 23:39:04 +0200 you wrote:
> 'struct config_item_type' is not modified in this driver.
> 
> This structure is only used with config_group_init_type_name() which takes
> a const struct config_item_type* as a 3rd argument.
> 
> This also makes things consistent with 'netconsole_target_type' witch is
> already const.
> 
> [...]

Here is the summary with links:
  - [net-next] net: netconsole: Constify struct config_item_type
    https://git.kernel.org/netdev/net-next/c/ed4290f39f41

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-14  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-10 21:39 [PATCH net-next] net: netconsole: Constify struct config_item_type Christophe JAILLET
2024-08-13 10:46 ` Breno Leitao
2024-08-14  2:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).