@@ -1090,10 +1090,10 @@ static void send_msg_fragmented(struct netconsole_target *nt,
int msg_len,
int release_len)
{
+ int header_len, msgbody_len, body_len;
static char buf[MAX_PRINT_CHUNK]; /* protected by target_list_lock */
int offset = 0, userdata_len = 0;
const char *header, *msgbody;
- int header_len, msgbody_len;
const char *release;
#ifdef CONFIG_NETCONSOLE_DYNAMIC
@@ -1124,10 +1124,11 @@ static void send_msg_fragmented(struct netconsole_target *nt,
memcpy(buf + release_len, header, header_len);
header_len += release_len;
+ body_len = msgbody_len + userdata_len;
/* for now on, the header will be persisted, and the msgbody
* will be replaced
*/
- while (offset < msgbody_len + userdata_len) {
+ while (offset < body_len) {
int this_header = header_len;
int this_offset = 0;
int this_chunk = 0;
@@ -1135,7 +1136,7 @@ static void send_msg_fragmented(struct netconsole_target *nt,
this_header += scnprintf(buf + this_header,
sizeof(buf) - this_header,
",ncfrag=%d/%d;", offset,
- msgbody_len + userdata_len);
+ body_len);
/* Not all msgbody data has been written yet */
if (offset < msgbody_len) {
@@ -1151,7 +1152,7 @@ static void send_msg_fragmented(struct netconsole_target *nt,
* write, append userdata in this chunk
*/
if (offset + this_offset >= msgbody_len &&
- offset + this_offset < userdata_len + msgbody_len) {
+ offset + this_offset < body_len) {
int sent_userdata = (offset + this_offset) - msgbody_len;
int preceding_bytes = this_chunk + this_header;