netdev-linux: avoid negative value cast to non-negative in comparison
authorZhengLingyun <konghuarukhr@163.com>
Thu, 18 Jul 2013 08:08:06 +0000 (16:08 +0800)
committerBen Pfaff <blp@nicira.com>
Thu, 18 Jul 2013 18:13:43 +0000 (11:13 -0700)
commitbb5c146881eb2b3d48962f89ecaa9598533a91c5
tree33da4354e7b1c6b7a3b4b98cdf84c09bc4a06b7f
parent261bd85427ad9732dbef396e3c481e19ea9ea55a
netdev-linux: avoid negative value cast to non-negative in comparison

I am using a userspace OVS, there is a constant ERR message in log:
"dpif_netdev|ERR|error receiving data from ovs-netdev: Message too long"
Check the code and find there is a comparison between ssize_t and size_t type in
netdev_rx_linux_recv(). It makes the negative "retval" greater than the "size".

Change the sequence of comparison to avoid negative return value cast to
a positive and become greater then a non-negative value.

Signed-off-by: ZhengLingyun <konghuarukhr@163.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/netdev-linux.c