knet: Fix knet log buffer size

knet sends log messages as struct knet_log_msg, not a string
of KNET_MAX_LOG_MSG_SIZE (which is only part of that structure).
So we were both losing and corrupting messages.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
This commit is contained in:
Christine Caulfield 2018-05-04 10:39:53 +01:00 committed by Jan Friesse
parent 23e17953fe
commit 5dda71ae29

View File

@ -542,7 +542,7 @@ static int log_deliver_fn (
void *data)
{
struct totemknet_instance *instance = (struct totemknet_instance *)data;
char buffer[KNET_MAX_LOG_MSG_SIZE*4];
char buffer[sizeof(struct knet_log_msg)*4];
char *bufptr = buffer;
int done = 0;
int len;
@ -572,8 +572,8 @@ static int log_deliver_fn (
msg->msg);
break;
}
bufptr += KNET_MAX_LOG_MSG_SIZE;
done += KNET_MAX_LOG_MSG_SIZE;
bufptr += sizeof(struct knet_log_msg);
done += sizeof(struct knet_log_msg);
}
return 0;
}