summaryrefslogtreecommitdiff
path: root/board/xilinx/common
diff options
context:
space:
mode:
Diffstat (limited to 'board/xilinx/common')
-rw-r--r--board/xilinx/common/fru_ops.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/board/xilinx/common/fru_ops.c b/board/xilinx/common/fru_ops.c
index a0a1441a8e..058e750c44 100644
--- a/board/xilinx/common/fru_ops.c
+++ b/board/xilinx/common/fru_ops.c
@@ -39,12 +39,20 @@ static int fru_check_language(u8 code)
u8 fru_checksum(u8 *addr, u8 len)
{
u8 checksum = 0;
+ u8 cnt = len;
while (len--) {
+ if (*addr == 0)
+ cnt--;
+
checksum += *addr;
addr++;
}
+ /* If all data bytes are 0's return error */
+ if (!cnt)
+ return EINVAL;
+
return checksum;
}