Skip to content

Commit

Permalink
libteam: check phys_port_id_len in update_phys_port_id
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
  • Loading branch information
jpirko committed Dec 18, 2014
1 parent 7b13dfa commit 5c7ab99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libteam/ifinfo.c
Expand Up @@ -149,14 +149,17 @@ static void update_phys_port_id(struct team_ifinfo *ifinfo,
nl_data = rtnl_link_get_phys_port_id(link);
if (nl_data) {
phys_port_id_len = nl_data_get_size(nl_data);
if (phys_port_id_len > MAX_PHYS_PORT_ID_LEN)
phys_port_id_len = 0;
phys_port_id = nl_data_get(nl_data);
}

if (ifinfo->phys_port_id_len != phys_port_id_len) {
ifinfo->phys_port_id_len = phys_port_id_len;
set_changed(ifinfo, CHANGED_PHYS_PORT_ID_LEN);
}
if (memcmp(ifinfo->phys_port_id, phys_port_id, phys_port_id_len)) {
if (phys_port_id_len &&
memcmp(ifinfo->phys_port_id, phys_port_id, phys_port_id_len)) {
memcpy(ifinfo->phys_port_id, phys_port_id, phys_port_id_len);
set_changed(ifinfo, CHANGED_PHYS_PORT_ID);
}
Expand Down

0 comments on commit 5c7ab99

Please sign in to comment.