]> www.infradead.org Git - users/hch/misc.git/commitdiff
netconsole: Warn if MAX_USERDATA_ITEMS limit is exceeded
authorBreno Leitao <leitao@debian.org>
Wed, 8 Jan 2025 11:50:25 +0000 (03:50 -0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 10 Jan 2025 02:06:36 +0000 (18:06 -0800)
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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250108-netcons_overflow_test-v3-1-3d85eb091bec@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netconsole.c

index f422a2f666ef2276cf5b10e1dbc6badbc8ef0038..86ab4a42769a49eebe5dd6f01dafafc6c86ec54f 100644 (file)
@@ -730,7 +730,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++;