From: Paolo Abeni Date: Tue, 22 Oct 2024 13:44:27 +0000 (+0200) Subject: Merge branch 'net-netconsole-refactoring-and-warning-fix' X-Git-Tag: v6.13-rc1~135^2~253 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06acd45e244dcc8191bc8df0983e29b284af1365;p=thirdparty%2Fkernel%2Flinux.git Merge branch 'net-netconsole-refactoring-and-warning-fix' Breno Leitao says: ==================== net: netconsole refactoring and warning fix The netconsole driver was showing a warning related to userdata information, depending on the message size being transmitted: ------------[ cut here ]------------ WARNING: CPU: 13 PID: 3013042 at drivers/net/netconsole.c:1122 write_ext_msg+0x3b6/0x3d0 ? write_ext_msg+0x3b6/0x3d0 console_flush_all+0x1e9/0x330 ... Identifying the cause of this warning proved to be non-trivial due to: * The write_ext_msg() function being over 100 lines long * Extensive use of pointer arithmetic * Inconsistent naming conventions and concept application The send_ext_msg() function grew organically over time: * Initially, the UDP packet consisted of a header and body * Later additions included release prepend and userdata * Naming became inconsistent (e.g., "body" excludes userdata, "header" excludes prepended release) This lack of consistency made investigating issues like the above warning more challenging than what it should be. To address these issues, the following steps were taken: * Breaking down write_ext_msg() into smaller functions with clear scopes * Improving readability and reasoning about the code * Simplifying and clarifying naming conventions Warning Fix ----------- The warning occurred when there was insufficient buffer space to append userdata. While this scenario is acceptable (as userdata can be sent in a separate packet later), the kernel was incorrectly raising a warning. A one-line fix has been implemented to resolve this issue. The fix was already sent to net, and is already available in net-next also. v4: * https://lore.kernel.org/all/20240930131214.3771313-1-leitao@debian.org/ v3: * https://lore.kernel.org/all/20240910100410.2690012-1-leitao@debian.org/ v2: * https://lore.kernel.org/all/20240909130756.2722126-1-leitao@debian.org/ v1: * https://lore.kernel.org/all/20240903140757.2802765-1-leitao@debian.org/ ==================== Link: https://patch.msgid.link/20241017095028.3131508-1-leitao@debian.org Signed-off-by: Paolo Abeni --- 06acd45e244dcc8191bc8df0983e29b284af1365