提交 9506902b 编写于 作者: M Matan Barak 提交者: Doug Ledford

IB/core: Fix dereference before check

Sparse complains about dereference before check. Fixing this by
moving the check before the dereference.

Fixes: 20029832 ('IB/core: Validate route when we init ah')
Signed-off-by: NMatan Barak <matanb@mellanox.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 2e2cdace
......@@ -497,13 +497,14 @@ int rdma_resolve_ip_route(struct sockaddr *src_addr,
struct sockaddr_storage ssrc_addr = {};
struct sockaddr *src_in = (struct sockaddr *)&ssrc_addr;
if (src_addr->sa_family != dst_addr->sa_family)
return -EINVAL;
if (src_addr) {
if (src_addr->sa_family != dst_addr->sa_family)
return -EINVAL;
if (src_addr)
memcpy(src_in, src_addr, rdma_addr_size(src_addr));
else
} else {
src_in->sa_family = dst_addr->sa_family;
}
return addr_resolve(src_in, dst_addr, addr, false);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册