#include "eal_private.h"
#define LOG_ELT_SIZE 2048
+#define LOG_BUF_SIZE (LOG_ELT_SIZE - sizeof(struct log_history))
#define LOG_HISTORY_MP_NAME "log_history"
}
/* not enough room for msg, buffer go back in mempool */
- if (size >= (LOG_ELT_SIZE - sizeof(*hist_buf))) {
+ if (size >= LOG_BUF_SIZE - 1) {
rte_mempool_mp_put(log_history_mp, hist_buf);
rte_spinlock_unlock(&log_list_lock);
return -ENOBUFS;
/* add in history */
memcpy(hist_buf->buf, buf, size);
- hist_buf->buf[LOG_ELT_SIZE-1] = '\0';
+ hist_buf->buf[size] = '\0';
hist_buf->size = size;
STAILQ_INSERT_TAIL(&log_history, hist_buf, next);
rte_spinlock_unlock(&log_list_lock);