diff options
author | Ben Pfaff <blp@ovn.org> | 2018-08-18 10:17:37 -0700 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-08-20 09:31:24 -0700 |
commit | 4e97034357082c3b689bbd7ddbc092f5c51454bb (patch) | |
tree | ac2a0f3c41da7fe86d6b0745b14b7fe9d51dcc74 | |
parent | 024d8a1e1b2beedfc3baa7ed4012a2c528f89e7a (diff) | |
download | openvswitch-4e97034357082c3b689bbd7ddbc092f5c51454bb.tar.gz |
netdev-linux: Avoid division by 0 if kernel reports bad scheduler data.
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 <bshastry@sect.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Yifeng Sun <pkusunyifeng@gmail.com>
-rw-r--r-- | lib/netdev-linux.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index f96429ffa..6227b009c 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -4862,7 +4862,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; } |