[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>


[ROCm/amdsmi commit: a2aae5e8a9]
This commit is contained in:
Bindhiya Kanangot Balakrishnan authored and Arif, Maisam committed 2025-10-30 10:49:38 -05:00
1 bovenliggende 4df843f110
commit 9973a6b324
1 file changed
+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;}