mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
s25f.c: Fix undefined behaviour on shift
dev_id, a uint8_t, was shifted left by 24 bits. After promotion to int, this results in shifting into the sign bit, which is undefined behaviour. Cast to uint32_t to prevent the promotion to signed int. BUG=None BRANCH=None TEST=None Change-Id: I88188ef2ba2af919eeae9ba08916374d31d8b989 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/68127 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:
parent
7c40ba24fe
commit
634da83f40
8
s25f.c
8
s25f.c
@ -380,10 +380,10 @@ int probe_spi_big_spansion(struct flashctx *flash)
|
||||
*/
|
||||
|
||||
uint32_t model_id =
|
||||
dev_id[1] << 24 |
|
||||
dev_id[2] << 16 |
|
||||
dev_id[4] << 8 |
|
||||
dev_id[5] << 0;
|
||||
(uint32_t)dev_id[1] << 24 |
|
||||
(uint32_t)dev_id[2] << 16 |
|
||||
(uint32_t)dev_id[4] << 8 |
|
||||
(uint32_t)dev_id[5] << 0;
|
||||
|
||||
if (dev_id[0] == flash->chip->manufacture_id && model_id == flash->chip->model_id)
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user