Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[swss] Replace memset functions #2423

Merged
merged 4 commits into from
Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions fpmsyncd/fpmlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bool FpmLink::isRawProcessing(struct nlmsghdr *h)
int len;
short encap_type = 0;
struct rtmsg *rtm;
struct rtattr *tb[RTA_MAX + 1];
struct rtattr *tb[RTA_MAX + 1] = {0};

rtm = (struct rtmsg *)NLMSG_DATA(h);

Expand All @@ -54,7 +54,6 @@ bool FpmLink::isRawProcessing(struct nlmsghdr *h)
return false;
}

memset(tb, 0, sizeof(tb));
netlink_parse_rtattr(tb, RTA_MAX, RTM_RTA(rtm), len);

if (!tb[RTA_MULTIPATH])
Expand Down Expand Up @@ -120,7 +119,7 @@ FpmLink::FpmLink(RouteSync *rsync, unsigned short port) :
m_server_up(false),
m_routesync(rsync)
{
struct sockaddr_in addr;
struct sockaddr_in addr = {};
int true_val = 1;

m_server_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
Expand All @@ -141,7 +140,6 @@ FpmLink::FpmLink(RouteSync *rsync, unsigned short port) :
throw system_error(errno, system_category());
}

memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
Expand Down
3 changes: 1 addition & 2 deletions fpmsyncd/routesync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ bool RouteSync::getEvpnNextHop(struct nlmsghdr *h, int received_bytes,
void RouteSync::onEvpnRouteMsg(struct nlmsghdr *h, int len)
{
struct rtmsg *rtm;
struct rtattr *tb[RTA_MAX + 1];
struct rtattr *tb[RTA_MAX + 1] = {0};
void *dest = NULL;
char anyaddr[16] = {0};
char dstaddr[16] = {0};
Expand All @@ -360,7 +360,6 @@ void RouteSync::onEvpnRouteMsg(struct nlmsghdr *h, int len)
rtm = (struct rtmsg *)NLMSG_DATA(h);

/* Parse attributes and extract fields of interest. */
memset(tb, 0, sizeof(tb));
netlink_parse_rtattr(tb, RTA_MAX, RTM_RTA(rtm), len);

if (tb[RTA_DST])
Expand Down
3 changes: 1 addition & 2 deletions mclagsyncd/mclaglink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ MclagLink::MclagLink(Select *select, int port) :
m_server_up(false),
m_select(select)
{
struct sockaddr_in addr;
struct sockaddr_in addr = {};
int true_val = 1;

m_server_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
Expand All @@ -1765,7 +1765,6 @@ MclagLink::MclagLink(Select *select, int port) :
throw system_error(errno, system_category());
}

memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons((unsigned short int)port);
addr.sin_addr.s_addr = htonl(MCLAG_DEFAULT_IP);
Expand Down
Loading