Skip to content

Commit

Permalink
Fix orchagent SEGV when PortConfigDone not set (sonic-net#803)
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshms-work authored and lguohan committed Mar 7, 2019
1 parent 3f14956 commit 5984e3a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,8 +1415,8 @@ bool PortsOrch::bake()
vector<FieldValueTuple> tuples;
string value;
bool foundPortConfigDone = m_portTable->hget("PortConfigDone", "count", value);
unsigned long portCount = stoul(value);
SWSS_LOG_NOTICE("foundPortConfigDone = %d, portCount = %lu, m_portCount = %u", foundPortConfigDone, portCount, m_portCount);
unsigned long portCount;
SWSS_LOG_NOTICE("foundPortConfigDone = %d", foundPortConfigDone);

bool foundPortInitDone = m_portTable->get("PortInitDone", tuples);
SWSS_LOG_NOTICE("foundPortInitDone = %d", foundPortInitDone);
Expand All @@ -1432,6 +1432,8 @@ bool PortsOrch::bake()
return false;
}

portCount = stoul(value);
SWSS_LOG_NOTICE("portCount = %lu, m_portCount = %u", portCount, m_portCount);
if (portCount != keys.size() - 2)
{
// Invalid port table
Expand Down

0 comments on commit 5984e3a

Please sign in to comment.