The parsing check for invalid log level was not trying to catch
irrelevant numeric values.
A log level 0 becomes a failure in parsing so it can be caught early.
A log level higher than the max (8) is accepted with a warning message.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: David Marchand <david.marchand@redhat.com>
}
priority = eal_parse_log_priority(level);
- if (priority < 0) {
- fprintf(stderr, "invalid log priority: %s\n", level);
+ if (priority <= 0) {
+ fprintf(stderr, "Invalid log level: %s\n", level);
goto fail;
}
+ if (priority > (int)RTE_LOG_MAX) {
+ fprintf(stderr, "Log level %d higher than maximum (%d)\n",
+ priority, RTE_LOG_MAX);
+ priority = RTE_LOG_MAX;
+ }
if (regex) {
if (rte_log_set_level_regexp(regex, priority) < 0) {