Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/30409 )
Change subject: Fix -Wsign-compare trouble ......................................................................
Patch Set 5: Code-Review+2
(5 comments)
https://review.coreboot.org/c/flashrom/+/30409/5/cbtable.c File cbtable.c:
https://review.coreboot.org/c/flashrom/+/30409/5/cbtable.c@43 PS5, Line 43: image + size - 0x10
Yes, it does. So what is the problem? […]
Yes, sorry, there is no problem, I was just double-checking that that was how it was parsed (since the other way can cause problems).
https://review.coreboot.org/c/flashrom/+/30409/5/cbtable.c@51 PS5, Line 51: image + size - 0x80
Ditto
Done
https://review.coreboot.org/c/flashrom/+/30409/5/cbtable.c@69 PS5, Line 69: image + size - mb_part_offset
Ditto
Done
https://review.coreboot.org/c/flashrom/+/30409/5/cbtable.c@70 PS5, Line 70: image + size - mb_vendor_offset
Ditto
Done
https://review.coreboot.org/c/flashrom/+/30409/5/fmap.c File fmap.c:
https://review.coreboot.org/c/flashrom/+/30409/5/fmap.c@99 PS5, Line 99: (len - sizeof(struct fmap))
Sure, but not part of this patch (the problem is in the subtraction not the […]
Gah! C is crazy. We only use off_t since this function needs to return negative error values (mumble mumble grumble), so we could just use size_t for `offset`, add an if check before the loop, and then do a cast to off_t at the very end when we return. Either that, or leave it as-is for now and change it in a follow-up. (Also, now that I think about it the signed version of size_t is ssize_t, not off_t, so perhaps a follow-up is better.)