From ac7a4f206efe2dd97c6e6d86c1db6bf39e40cd86 Mon Sep 17 00:00:00 2001 From: Matthew Raybuck Date: Fri, 29 Mar 2019 14:12:51 -0500 Subject: Fix UCD retry loop size bug There is a bug in the attemptDeviceOp code where an error during the deviceOp function will overwrite the io_bufferLength value causing the retry loop to fail permanently on subsequent retries. Change-Id: Ib525e60e1c6cca2604a279cc595946a92cd4f94d RTC: 205982 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75243 Reviewed-by: Michael Baiocchi Reviewed-by: Ilya Smirnov Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Nicholas E. Bofferding --- src/usr/isteps/ucd/updateUcdFlash.C | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/usr') diff --git a/src/usr/isteps/ucd/updateUcdFlash.C b/src/usr/isteps/ucd/updateUcdFlash.C index 5648a331f..267fb06fc 100644 --- a/src/usr/isteps/ucd/updateUcdFlash.C +++ b/src/usr/isteps/ucd/updateUcdFlash.C @@ -1282,14 +1282,22 @@ public: errlHndl_t pNonRetryableError = nullptr; errlHndl_t pRetryableError = nullptr; errlHndl_t pUcdError = nullptr; + size_t size = 0; for (uint8_t retry = 0; retry <= UCD_MAX_RETRIES; ++retry) { + // If an error occurs during the deviceOp then it's possible the + // size will be overwritten. So, create a local variable with the + // requested size. Regardless of success or failure the size + // returned from the final deviceOp will be written to + // io_bufferLength. + size = io_bufferLength; + // Perform deviceOp pUcdError = performDeviceOp(i_opType, i_smbusOpType, io_buffer, - io_bufferLength, + size, i_cmd); if ( (pUcdError != nullptr) @@ -1410,6 +1418,10 @@ public: } } + // Regardless of success or failure, update io_bufferLength with final + // size returned from performDeviceOp(). + io_bufferLength = size; + return pNonRetryableError; } -- cgit v1.2.1