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

Matthew Hall mhall at mhcomputing.net
Fri Nov 13 07:47:38 CET 2015


Signed-off-by: Matthew Hall <mhall at mhcomputing.net>
---
 lib/librte_eal/linuxapp/eal/eal_log.c | 1 +
 1 file changed, 1 insertion(+)

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';
 
-- 
1.9.1



More information about the dev mailing list