Commit 499c1b2
committed
helios64: defensive fixes on top of u-boot v2026.04 bump
Code-style and defensive-programming fixes to the helios64 u-boot
overlay, applied on top of the pristine v2026.04 vendor bump. All
changes are additive safety nets — none alter the happy-path
behaviour of the previous Kobol/Armbian code.
board/helios64.c: check led_get_by_label() return value in
setup_leds(). Without this, led_set_state() is called on an
uninitialised udevice pointer if LED lookup fails.
board/sys_otp.c:
- replace the || chain magic-number check in is_valid_header()
with memcmp() against a const expected_magic[8] (fixes a real
pre-existing bug: the || chain was always true);
- introduce otp_serial() / otp_mfg_year() helpers that assemble
the multi-byte values byte-by-byte, eliminating unaligned
u64/u16 casts into the packed otp struct (UB per the C standard,
also over-read into adjacent fields);
- bounds-check otp.variant against BOARD_VARIANT_MAX before
indexing var_str[], adding BOARD_VARIANT_INVALID slot;
- use strnlen() when printing packed fixed-length fields;
- use snprintf() with target buffer size instead of sprintf();
- retry read_otp_data() in ensure_otp_data_ready() on the first
access after a failed board_early_init_r(), instead of silently
skipping OTP-provided values for the whole boot.
cmd-fileenv-read-string-from-file-into-env.patch:
add 'depends on CMD_FAT' to the cherry-picked CMD_FILEENV Kconfig
entry. do_fat_fsload() is called unconditionally from the
fileenv implementation, so the dependency reflects reality.
general-fix-btrfs-zstd-decompression.patch:
tighten the decompression-success check to also reject short
reads ('|| ret < dlen'). zstd_is_error() alone does not cover
truncated output.
Assisted-by: Claude:claude-opus-4-71 parent 0290be2 commit 499c1b2
4 files changed
Lines changed: 70 additions & 23 deletions
File tree
- patch/u-boot/v2026.04/board_helios64
- board
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
183 | 190 | | |
184 | | - | |
185 | 191 | | |
186 | 192 | | |
187 | 193 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 53 | + | |
| 54 | + | |
51 | 55 | | |
52 | | - | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
55 | 84 | | |
56 | 85 | | |
57 | 86 | | |
| |||
97 | 126 | | |
98 | 127 | | |
99 | 128 | | |
100 | | - | |
101 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
102 | 135 | | |
103 | | - | |
104 | | - | |
| 136 | + | |
105 | 137 | | |
106 | | - | |
| 138 | + | |
107 | 139 | | |
108 | 140 | | |
109 | 141 | | |
| |||
160 | 192 | | |
161 | 193 | | |
162 | 194 | | |
163 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
164 | 202 | | |
165 | 203 | | |
166 | 204 | | |
| |||
180 | 218 | | |
181 | 219 | | |
182 | 220 | | |
183 | | - | |
| 221 | + | |
184 | 222 | | |
185 | 223 | | |
186 | 224 | | |
| |||
191 | 229 | | |
192 | 230 | | |
193 | 231 | | |
194 | | - | |
| 232 | + | |
195 | 233 | | |
196 | 234 | | |
197 | 235 | | |
198 | 236 | | |
199 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
200 | 241 | | |
201 | 242 | | |
202 | | - | |
| 243 | + | |
203 | 244 | | |
204 | 245 | | |
205 | 246 | | |
| |||
208 | 249 | | |
209 | 250 | | |
210 | 251 | | |
211 | | - | |
| 252 | + | |
212 | 253 | | |
213 | 254 | | |
214 | 255 | | |
215 | 256 | | |
216 | 257 | | |
217 | | - | |
218 | | - | |
| 258 | + | |
219 | 259 | | |
220 | 260 | | |
221 | 261 | | |
| |||
224 | 264 | | |
225 | 265 | | |
226 | 266 | | |
227 | | - | |
| 267 | + | |
228 | 268 | | |
229 | 269 | | |
230 | 270 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
0 commit comments