1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

Add clarification to struct flash_region on chipoff_t

Although chipoff_t is fairly clearly documented on its own, it seems
fairly frequent that developers will treat the end address of a flash
region as an exclusive upper bound rather than the inclusive one it
should be; for example CB:82496 fixes an incorrect use that affected
multiple sites, and CB:73571 stemmed from a similar cause. Add a
clarifying comment to call attention to this, to help programmers avoid
making similar mistakes in the future.

Change-Id: I80b61a87ca31bd5a116224aadb4e211ee6841e1f
Signed-off-by: Peter Marheine <pmarheine@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/82677
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Peter Marheine 2024-05-28 12:53:40 +10:00
parent 510ef74653
commit d7e4240263

View File

@ -37,6 +37,11 @@ typedef uint32_t chipsize_t; /* Able to store the number of bytes of any support
struct flash_region {
char *name;
/*
* Note that because start and end are chipoff_t, end is an inclusive upper
* bound: the length of a region is (end - start + 1) bytes and it is
* impossible to represent a region with zero length.
*/
chipoff_t start;
chipoff_t end;
bool read_prot;