Commit c015eb7
committed
u-boot: v2026.04: helios64: fix OTP magic check (any-byte → all bytes)
Per CodeRabbit review on PR armbian#9675:
is_valid_header() in board/sys_otp.c uses '||' between byte
comparisons, returning 1 if *any* one byte of otp.magic matches
the expected sequence. Practically every random byte pattern will
trip at least one comparison, so the magic check is effectively
meaningless — partially corrupt OTP data is treated as a valid
Helios64 header.
This is a pre-existing bug in the Kobol vendor code, carried forward
unchanged through every U-Boot bump. We are migrating these board
files to v2026.04, so the right place to fix it.
Replace the chain with a single memcmp() against the expected magic:
- removes the '||' vs '&&' confusion entirely;
- reads as a normal magic-bytes check;
- the constant lives in one place.1 parent 7d9279e commit c015eb7
1 file changed
Lines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 48 | + | |
51 | 49 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 50 | + | |
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
| |||
0 commit comments