Skip to content

Commit 4085d3f

Browse files
andywongaristayxieca
authored andcommitted
Revert hwinfo count change (#2383)
What I did Revert change from #2367 which increases count associated with SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO by 1, as well as the memset. Why I did it Original intention of this change was to accommodate sairedis behaviour when copying null-terminated string; original behaviour is that the null-terminator would not be copied and so receiver of the hwinfo (PAI) would see non-null terminated string. Reverting this change so that old behaviour is maintained and PAI driver is responsible for not relying on string to be null terminated.
1 parent facc3a4 commit 4085d3f

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

orchagent/saihelper.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -378,11 +378,10 @@ sai_status_t initSaiPhyApi(swss::gearbox_phy_t *phy)
378378
SWSS_LOG_ERROR( "hwinfo string attribute is too long." );
379379
return SAI_STATUS_FAILURE;
380380
}
381-
memset(hwinfo, 0, HWINFO_MAX_SIZE + 1);
382381
strncpy(hwinfo, phy->hwinfo.c_str(), phy->hwinfo.length());
383382

384383
attr.id = SAI_SWITCH_ATTR_SWITCH_HARDWARE_INFO;
385-
attr.value.s8list.count = (uint32_t) phy->hwinfo.length() + 1;
384+
attr.value.s8list.count = (uint32_t) phy->hwinfo.length();
386385
attr.value.s8list.list = (int8_t *) hwinfo;
387386
attrs.push_back(attr);
388387

0 commit comments

Comments
 (0)