If the kernel reported a value of 0 for the second value in /proc/net/psched, it would cause a division-by-zero fault in read_psched(). I don't know of a kernel that would actually do that, but it's still better to be safe.
Found by clang static analyzer Reported-by: Bhargava Shastry <[email protected]> Signed-off-by: Ben Pfaff <[email protected]> --- lib/netdev-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 0c42268d9d6c..e16ea58a085e 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -5166,7 +5166,7 @@ read_psched(void) VLOG_DBG("%s: psched parameters are: %u %u %u %u", fn, a, b, c, d); fclose(stream); - if (!a || !c) { + if (!a || !b || !c) { VLOG_WARN("%s: invalid scheduler parameters", fn); goto exit; } -- 2.16.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
