Skip to content

Commit d94785b

Browse files
leitaokuba-moo
authored andcommitted
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/0x330 The 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. Fixes: 1ec9daf ("net: netconsole: append userdata to fragmented netconsole messages") Signed-off-by: Breno Leitao <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8c92436 commit d94785b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/net/netconsole.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,8 +1161,14 @@ static void send_ext_msg_udp(struct netconsole_target *nt, const char *msg,
11611161

11621162
this_chunk = min(userdata_len - sent_userdata,
11631163
MAX_PRINT_CHUNK - preceding_bytes);
1164-
if (WARN_ON_ONCE(this_chunk <= 0))
1164+
if (WARN_ON_ONCE(this_chunk < 0))
1165+
/* this_chunk could be zero if all the previous
1166+
* message used all the buffer. This is not a
1167+
* problem, userdata will be sent in the next
1168+
* iteration
1169+
*/
11651170
return;
1171+
11661172
memcpy(buf + this_header + this_offset,
11671173
userdata + sent_userdata,
11681174
this_chunk);

0 commit comments

Comments
 (0)