[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>
This commit is contained in:
committed by
Arif, Maisam
parent
0a5fdc944f
commit
a2aae5e8a9
@@ -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;}
|
||||
|
||||
Reference in New Issue
Block a user