Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,  Shuah Khan <shuah@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-kselftest@vger.kernel.org,
	Breno Leitao <leitao@debian.org>
Subject: [PATCH net-next 1/4] netconsole: Warn if MAX_USERDATA_ITEMS limit is exceeded
Date: Wed, 04 Dec 2024 08:40:42 -0800	[thread overview]
Message-ID: <20241204-netcons_overflow_test-v1-1-a85a8d0ace21@debian.org> (raw)
In-Reply-To: <20241204-netcons_overflow_test-v1-0-a85a8d0ace21@debian.org>

netconsole configfs helpers doesn't allow the creation of more than
MAX_USERDATA_ITEMS items.

Add a warning when netconsole userdata update function attempts sees
more than MAX_USERDATA_ITEMS entries.

Replace silent ignore mechanism with WARN_ON_ONCE() to highlight
potential misuse during development and debugging.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 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 4ea44a2f48f7b1f9059d275f0f0edc40cc1997f0..8b9dd4842f3e516c7eaa08205a45092e64417440 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -705,7 +705,7 @@ static void update_userdata(struct netconsole_target *nt)
 		struct userdatum *udm_item;
 		struct config_item *item;
 
-		if (child_count >= MAX_USERDATA_ITEMS)
+		if (WARN_ON_ONCE(child_count >= MAX_USERDATA_ITEMS))
 			break;
 		child_count++;
 

-- 
2.43.5


  reply	other threads:[~2024-12-04 16:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04 16:40 [PATCH net-next 0/4] netconsole: selftest for userdata overflow Breno Leitao
2024-12-04 16:40 ` Breno Leitao [this message]
2024-12-06 15:11   ` [PATCH net-next 1/4] netconsole: Warn if MAX_USERDATA_ITEMS limit is exceeded Simon Horman
2024-12-04 16:40 ` [PATCH net-next 2/4] netconsole: selftest: Split the helpers from the selftest Breno Leitao
2024-12-06 15:11   ` Simon Horman
2024-12-04 16:40 ` [PATCH net-next 3/4] netconsole: selftest: Delete all userdata keys Breno Leitao
2024-12-06 15:11   ` Simon Horman
2024-12-04 16:40 ` [PATCH net-next 4/4] netconsole: selftest: verify userdata entry limit Breno Leitao
2024-12-06 15:09   ` Simon Horman
2025-01-03 11:48     ` Breno Leitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241204-netcons_overflow_test-v1-1-a85a8d0ace21@debian.org \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox