get_prob() takes "nan" as 0 and ignores trailing characters. Refuse both. Fixes: d7f3299d591e ("tc : SFB flow scheduler") Signed-off-by: Andrii Tereshchenko --- sfb increment nan: was increment 0, now Illegal "increment". tc/q_sfb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tc/q_sfb.c b/tc/q_sfb.c index 6a26b71a..9ea7cc28 100644 --- a/tc/q_sfb.c +++ b/tc/q_sfb.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include "utils.h" #include "tc_util.h" @@ -34,8 +36,10 @@ static int get_prob(__u32 *val, const char *arg) if (!arg || !*arg) return -1; d = strtod(arg, &ptr); - if (!ptr || ptr == arg || d < 0.0 || d > 1.0) + if (!ptr || ptr == arg || *ptr || isnan(d)) return -1; + if (d < 0.0 || d > 1.0) + return -ERANGE; *val = (__u32)(d * SFB_MAX_PROB + 0.5); return 0; } base-commit: 06b62d179bbb5b62cba965dcda48a613dbc59416 -- 2.53.0