From: Breno Leitao Date: Wed, 8 Jan 2025 11:50:25 +0000 (-0800) Subject: netconsole: Warn if MAX_USERDATA_ITEMS limit is exceeded X-Git-Tag: microblaze-v6.16~163^2~105^2~3 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=e51c7478d23bb484d414fc036cd1ff57afe31b67;p=linux-2.6-microblaze.git netconsole: Warn if MAX_USERDATA_ITEMS limit is exceeded 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 Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250108-netcons_overflow_test-v3-1-3d85eb091bec@debian.org Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index f422a2f666ef..86ab4a42769a 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -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++;