Repository navigation
Match the full property name in the Versal device tree lookup and test it - #203
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Property-name validation uses the blob boundary instead of the string-table boundary, allowing names with terminators outside the declared string table to be accepted.
1 open issue
What changed in this PR
This PR hardens the device-tree lookup used by the Versal OTA example to identify its boot slot and makes the parser testable on the host.
Changes:
- Extracts the lookup into a separate module and compares the full property name, including its terminator.
- Adds host tests for valid, truncated, and corrupted device trees.
- Integrates the parser into the Versal build and adds a wolfSSL-independent test target to Linux CI.
| File | Description |
|---|---|
src/test/test_ota_fdt.c |
Adds device-tree lookup tests. |
src/port/amd/boards/versal/ota_store.c |
Uses the extracted lookup function. |
src/port/amd/boards/versal/ota_fdt.h |
Declares and documents the lookup API. |
src/port/amd/boards/versal/ota_fdt.c |
Implements the parser with full-name comparison. |
src/port/amd/boards/versal/Makefile |
Links the parser into OTA builds. |
Makefile |
Adds the wolfSSL-independent host test target. |
.github/workflows/linux.yml |
Builds and runs the new host test. |
Review effort: Balanced
|
dgarske
force-pushed
the
versal_ota_fdt
branch
from
December 1, 2026 23:04
f3aae86 to
9b4b0d1
Compare
gasbytes
self-requested a review
December 2, 2026 18:03
gasbytes
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

The Versal update example reads
/chosen/wolfboot,boot-partfrom the device tree wolfBoot passes in, to learn which slot it booted from.fdt_find_u32()compared the property name withstrncmp()bounded by the bytes left in the string table. When the table ended partway through a name, only the bytes present were compared, so a truncatedwolfboot,boot-p...matchedwolfboot,boot-part. The lookup now requires the whole name and its terminator to lie inside the table.src/port/amd/boards/versal/ota_fdt.c,ota_fdt.h: the lookup, moved out ofota_store.cso it builds on the hostsrc/test/test_ota_fdt.c: host unit test with well-formed, truncated and corrupted treesMakefile,linux.yml:build/test-ota-fdttarget, run in the Linux workflow (no wolfSSL needed)Tested on a VMK180: update, tampered image rejected, wrong client certificate not confirmed, unconfirmed image rolled back, from both slots.