[SWDEV-558046] Fix topology weight corruption due to casting

The out of bound writes caused corruption in next field,
which was weight. Fixed by reading to a temp and then assigning
safely.

Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>
이 커밋은 다음에 포함됨:
Bindhiya Kanangot Balakrishnan
2025-10-29 18:19:32 -05:00
커밋한 사람 Arif, Maisam
부모 0a5fdc944f
커밋 a2aae5e8a9
+3 -1
파일 보기
@@ -351,6 +351,7 @@ int IOLink::ReadProperties(void) {
int
IOLink::Initialize(void) {
int ret = 0;
uint64_t tmp64 = 0;
ret = ReadProperties();
if (ret) {return ret;}
@@ -369,8 +370,9 @@ IOLink::Initialize(void) {
ret = get_property_value(kIOLinkPropWEIGHTStr, &weight_);
if (ret) {return ret;}
ret = get_property_value(kIOLinkPropFLAGSStr, reinterpret_cast<uint64_t *>(&flags_));
ret = get_property_value(kIOLinkPropFLAGSStr, &tmp64);
if (ret) {return ret;}
flags_ = static_cast<uint32_t>(tmp64);
ret = UpdateP2pCapability();
if (ret) {return ret;}