net: netconsole: fix wrong warning
Subsystems (3)
Breno Leitao
maintainerPATCH 1/1 net: netconsole: fix wrong warning
A warning is triggered when there is insufficient space in the buffer for userdata. However, this is not an issue since userdata will be sent in the next iteration.
Current warning message:
------------[ 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/0x330The code incorrectly issues a warning when this_chunk is zero, which is a valid scenario. The warning should only be triggered when this_chunk is negative.
--- drivers/net/netconsole.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/netconsole.c +7 -1
@@ -1161,8 +1161,14 @@ static void send_ext_msg_udp(struct netconsole_target *nt, const char *msg, this_chunk =min (userdata_len - sent_userdata,MAX_PRINT_CHUNK - preceding_bytes); -if (WARN_ON_ONCE (this_chunk <=0 )) +if (WARN_ON_ONCE (this_chunk <0 )) +/* this_chunk could be zero if all the previous +* message used all the buffer. This is not a +* problem, userdata will be sent in the next +* iteration +*/ return ; +memcpy (buf + this_header + this_offset, userdata + sent_userdata, this_chunk);
Signature · 1 line
2.43.5
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 8 Oct 2024 02:43:24 -0700 you wrote:
A warning is triggered when there is insufficient space in the buffer for userdata. However, this is not an issue since userdata will be sent in the next iteration.
Current warning message:
[...]
Here is the summary with links:
- [net] net: netconsole: fix wrong warning
https://git.kernel.org/netdev/net/c/d94785bb46b6
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html