diff --git a/drivers/net/tap/tap_netlink.c b/drivers/net/tap/tap_netlink.c index d9c260127d5..35c491ac37c 100644 --- a/drivers/net/tap/tap_netlink.c +++ b/drivers/net/tap/tap_netlink.c @@ -302,7 +302,8 @@ tap_nlattr_add(struct nlmsghdr *nh, unsigned short type, rta = (struct rtattr *)NLMSG_TAIL(nh); rta->rta_len = RTA_LENGTH(data_len); rta->rta_type = type; - memcpy(RTA_DATA(rta), data, data_len); + if (data_len > 0) + memcpy(RTA_DATA(rta), data, data_len); nh->nlmsg_len = NLMSG_ALIGN(nh->nlmsg_len) + RTA_ALIGN(rta->rta_len); }