diff options
author | Thomas Haller <thaller@redhat.com> | 2022-04-22 17:23:23 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-04-22 17:23:59 (GMT) |
commit | bf3585ff248ab309f12a328687ac895f09bc0709 (patch) | |
tree | 96d62ff763a17ffb6495d9a95cbd881c78e6dee5 | |
parent | dd06d225083c3423eafc792f2bc1d0562c185c20 (diff) | |
download | libnl-bf3585ff248ab309f12a328687ac895f09bc0709.zip libnl-bf3585ff248ab309f12a328687ac895f09bc0709.tar.gz libnl-bf3585ff248ab309f12a328687ac895f09bc0709.tar.bz2 |
route/link/sriov: fix initializing vlans in rtnl_link_sriov_clone()
Error: SIZEOF_MISMATCH (CWE-398):
libnl-3.6.0/lib/route/link/sriov.c:125: suspicious_sizeof: Passing argument "dst_vlan_info" of type "nl_vf_vlan_info_t *" and argument "dst_vlans->size * 8UL /* sizeof (dst_vlan_info) */"
libnl-3.6.0/lib/route/link/sriov.c:125: remediation: Did you intend to use "sizeof (*dst_vlan_info)" instead of "sizeof (dst_vlan_info)"?
# 123| dst_vlan_info = dst_vlans->vlans;
# 124| memcpy(dst_vlans, src_vlans, sizeof(nl_vf_vlans_t));
# 125|-> memcpy(dst_vlan_info, src_vlan_info,
# 126| dst_vlans->size * sizeof(dst_vlan_info));
# 127| d_vf->vf_vlans = dst_vlans;
Fixes: a59cab6d0b0f ('lib/route: SRIOV Clone Support')
-rw-r--r-- | lib/route/link/sriov.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/route/link/sriov.c b/lib/route/link/sriov.c index 4008fc9..46fa645 100644 --- a/lib/route/link/sriov.c +++ b/lib/route/link/sriov.c @@ -123,7 +123,7 @@ int rtnl_link_sriov_clone(struct rtnl_link *dst, struct rtnl_link *src) { dst_vlan_info = dst_vlans->vlans; memcpy(dst_vlans, src_vlans, sizeof(nl_vf_vlans_t)); memcpy(dst_vlan_info, src_vlan_info, - dst_vlans->size * sizeof(dst_vlan_info)); + dst_vlans->size * sizeof(*dst_vlan_info)); d_vf->vf_vlans = dst_vlans; } |