numam-dpdk/lib/librte_vhost
Bruce Richardson d65b3b1668 vhost: fix false-positive warning from clang 5
When compiling with clang extra warning flags, such as used by default with
meson, a warning is given in iotlb.c:

lib/librte_vhost/iotlb.c:318:6: warning:
	variable 'socket' is used uninitialized whenever
	'if' condition is false [-Wsometimes-uninitialized]

This is a false positive, as the socket value will be initialized by the
call to get_mempolicy in the case where the NUMA build-time flag is set,
and in cases where it is not set, "if (ret)" will always be true as ret is
initialized to -1 and never changed.

However, this is not immediately obvious, and is perhaps a little fragile,
as it will break if other code using ret is subsequently added above the
call to get_mempolicy by someone unaware of this subtle dependency.
Therefore, we can fix the warning and making the code more robust by
explicitly initializing socket to zero, and moving the extra condition
check on the return from get_mempolicy() into the #ifdef

Fixes: d012d1f293 ("vhost: add IOTLB helper functions")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2017-10-11 13:56:34 +02:00
..
fd_man.c vhost: check poll error code 2017-10-10 15:54:31 +02:00
fd_man.h
iotlb.c vhost: fix false-positive warning from clang 5 2017-10-11 13:56:34 +02:00
iotlb.h vhost: add pending IOTLB miss request list and helpers 2017-10-10 15:52:27 +02:00
Makefile vhost: add IOTLB helper functions 2017-10-10 15:52:27 +02:00
rte_vhost_version.map
rte_vhost.h vhost: add user callbacks for socket open/close 2017-10-10 15:54:31 +02:00
socket.c vhost: add user callbacks for socket open/close 2017-10-10 15:54:31 +02:00
vhost_user.c vhost: distinguish master and slave requests 2017-10-10 15:54:31 +02:00
vhost_user.h vhost: distinguish master and slave requests 2017-10-10 15:54:31 +02:00
vhost.c vhost: invalidate vring in case of matching IOTLB invalidate 2017-10-10 15:52:27 +02:00
vhost.h vhost: enable IOMMU support 2017-10-10 15:53:27 +02:00
virtio_net.c vhost: postpone device creation until rings are mapped 2017-10-10 15:52:27 +02:00