Lee Leahy has posted comments on this change. ( https://review.coreboot.org/19643 )
Change subject: drivers/storage: Fix array references ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/19643/2/src/drivers/storage/storage.c File src/drivers/storage/storage.c:
PS2, Line 77: ARRAY_SIZE(decimal_list) - 1
Why is it minus 1? If the '1' entries don't matter remove them? And just ch
The less than ensures that index only references actual elements of the array. The minus one handles the case where capacity is zero and returns an index of (ARRAY_SIZE(array) - 1) which is the last element of the array with a divisor of 1 and units of bytes. This eliminates the need for special case code to handle the zero capacity case. Coverity should be happy now since all possible exits from the loop have a valid index value.