[PATCH v2 07/17] commands: tlv: Error out on invalid TLVs
Jonas Rebmann
jre at pengutronix.de
Tue Oct 28 11:03:12 PDT 2025
TLV parsing happens in the TLV drivers probe function
(tlv_probe_from_magic()) but register_device() does not propagate
errors from match(), always returning zero.
match() however ensures that dev->driver is always NULL if an error
occurred on probe and since we're only probing the TLV driver, rely on
that as indicator of an error during TLV parsing (e.g. CRC mismatch).
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
Signed-off-by: Jonas Rebmann <jre at pengutronix.de>
---
commands/tlv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commands/tlv.c b/commands/tlv.c
index 6118a2947f..c01a7b0399 100644
--- a/commands/tlv.c
+++ b/commands/tlv.c
@@ -29,7 +29,7 @@ static int do_tlv(int argc, char *argv[])
return COMMAND_ERROR_USAGE;
tlvdev = tlv_register_device_by_path(filename, NULL);
- if (IS_ERR(tlvdev)) {
+ if (IS_ERR(tlvdev) || tlvdev->dev.driver == NULL) {
printf("Could not open \"%s\": %m\n", filename);
return COMMAND_ERROR;
}
--
2.51.2.535.g419c72cb8a
More information about the barebox
mailing list