Whamcloud - gitweb
LU-10391 lnet: fix uninitialize var in choose_ipv4_src() 23/38823/2
authorMr NeilBrown <neilb@suse.de>
Wed, 3 Jun 2020 22:57:31 +0000 (08:57 +1000)
committerOleg Drokin <green@whamcloud.com>
Wed, 10 Jun 2020 20:51:28 +0000 (20:51 +0000)
commit8ea895389a92dbd08fb398dbda0a8f0f2dde063b
tree50bf69e78ff0c54205a3144a7b62c70108a55381
parent9e1071b517578ed3752efb1412017c8f93cd333b
LU-10391 lnet: fix uninitialize var in choose_ipv4_src()

choose_ip4_src() test "*ret" without initializing it - and callers do
not (and should not) initialize the var.

Instead of testing "*ret", test "err" - if this is non-zero (it will
be -ENOENT) we want to use the address.  If it is zero, then we only
use the address if it is on the right subnet.

Test-Parameters: trivial
Reported-by: Amir Shehata <ashehata@whamcloud.com>
Fixes: d720fbaadad9 ("LU-10391 socklnd: use interface index to track local addr")
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I9b83207b790db07c06be1ee1c534a0fc63eb9ffa
Reviewed-on: https://review.whamcloud.com/38823
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Aurelien Degremont <degremoa@amazon.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-socket.c