ich_descriptors.c: Ensure unsigned types >=0 on to prevent underflow

Unsigned types show undefined behaviour if they are subtracted by a
value greater than their own (mostly it wraps to the max value). Using
this value for left shifting could be even more dangerous.

flashrom-stable:
The actual issue here was that a static-analyzer didn't realize that
the second loop would only run, if ever, with `j >= 12`. So we made
that explicit.

Change-Id: I5921cc571f3dca5188ca1973dba6ececbcbe2f39
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/62764
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71451
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
1 file changed