[dpdk-dev,6/6] eal_log.c: limit syslog level to RTE_SYSLOG_LEVEL_MAX

Message ID 1447397258-27233-7-git-send-email-mhall@mhcomputing.net (mailing list archive)
State Rejected, archived
Headers

Commit Message

Matthew Hall Nov. 13, 2015, 6:47 a.m. UTC
  Signed-off-by: Matthew Hall <mhall@mhcomputing.net>
---
 lib/librte_eal/linuxapp/eal/eal_log.c | 1 +
 1 file changed, 1 insertion(+)
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal_log.c b/lib/librte_eal/linuxapp/eal/eal_log.c
index 0b133c3..dbeff75 100644
--- a/lib/librte_eal/linuxapp/eal/eal_log.c
+++ b/lib/librte_eal/linuxapp/eal/eal_log.c
@@ -73,6 +73,7 @@  console_log_write(__attribute__((unused)) void *c, const char *buf, size_t size)
 
 	/* Syslog error levels are from 0 to 7, so subtract 1 to convert */
 	loglevel = rte_log_cur_msg_loglevel() - 1;
+	loglevel = loglevel > RTE_SYSLOG_LEVEL_MAX ? RTE_SYSLOG_LEVEL_MAX : loglevel;
 	memcpy(copybuf, buf, size);
 	copybuf[size] = '\0';