Modify count, payload to u32 and reset written_records to 0 on MAX.
Modified count, payload to u32 as they were ( specifically count ) getting wrap around if the payload length in the frame is of a greater value ( > 60 K). This resulted in the count getting recalculated with a different offset, due to wrap around. This scenario resulted in to the while loop never to exit due to count getting improperly calculated. Avoid this by changing the respective variables to u32 Change-Id: I8cbd2818b20fe33872abab99e17259a5a367b151 CRs-Fixed: 2708208
Loading