Skip to content

Commit 5984e3a

Browse files
rameshms-worklguohan
authored andcommitted
Fix orchagent SEGV when PortConfigDone not set (sonic-net#803)
1 parent 3f14956 commit 5984e3a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

orchagent/portsorch.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -1415,8 +1415,8 @@ bool PortsOrch::bake()
14151415
vector<FieldValueTuple> tuples;
14161416
string value;
14171417
bool foundPortConfigDone = m_portTable->hget("PortConfigDone", "count", value);
1418-
unsigned long portCount = stoul(value);
1419-
SWSS_LOG_NOTICE("foundPortConfigDone = %d, portCount = %lu, m_portCount = %u", foundPortConfigDone, portCount, m_portCount);
1418+
unsigned long portCount;
1419+
SWSS_LOG_NOTICE("foundPortConfigDone = %d", foundPortConfigDone);
14201420

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

1435+
portCount = stoul(value);
1436+
SWSS_LOG_NOTICE("portCount = %lu, m_portCount = %u", portCount, m_portCount);
14351437
if (portCount != keys.size() - 2)
14361438
{
14371439
// Invalid port table

0 commit comments

Comments
 (0)