Files
u-boot/cmd
Rasmus Villemoes 3c2a947533 disk/part.c: ensure strings in struct disk_partition are valid after successful get_info
Not all ->get_info implementations necessarily populate all the string
members of struct disk_partition.

Currently, only part_get_info_by_type() (and thereby part_get_info)
ensure that the uuid strings are initialized; part_get_info_by_type()
and part_get_info_by_uuid() do not. In fact, the latter could lead to
a false positive match - if the ->get_info backend does not populate
info->uuid, stale contents in info could cause the strncasecmp() to
succeed.

None of the functions currently ensure that the ->name and ->type
strings are initialized.

Instead of forcing all callers of any of these functions to
pre-initialize info, or all implementations of the ->get_info method
to ensure there are valid C strings in all four fields, create a small
helper function and factor all invocations of ->get_info through that.

This also consolidates the -ENOSYS check and standardizes on using
log_debug() for reporting absence, instead of the current mix of
PRINTF and log_debug(). It does mean we have to special-case -ENOSYS
in the error cases inside the loops in the _by_uuid() and _by_name()
functions, but it's still a net win in #LOC.

Acked-by: Quentin Schulz <quentin.schulz@cherry.de>
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Tested-by: Anshul Dalal <anshuld@ti.com>
2025-11-18 12:51:09 -06:00
..
2017-02-08 15:56:28 -05:00
2025-04-03 11:43:22 -06:00
2025-07-11 10:43:29 -06:00
2024-02-15 10:38:34 +01:00
2025-09-24 11:03:43 -06:00
2025-05-13 11:30:08 -06:00
2025-05-30 09:49:31 +01:00
2024-10-09 22:04:56 -06:00
2024-07-15 12:12:17 -06:00
2024-08-02 15:16:51 -03:00
2024-07-15 12:12:17 -06:00
2024-08-13 06:12:40 +02:00
2024-09-12 17:35:37 +02:00
2024-09-12 17:35:37 +02:00
2025-05-25 11:27:18 +02:00
2022-03-15 16:19:29 -04:00
2024-10-29 16:17:47 -06:00
2025-07-09 08:40:03 -06:00
2024-10-18 14:10:21 -06:00
2025-04-02 20:00:59 -06:00
2025-07-08 15:00:17 +02:00
2025-08-06 07:49:13 +02:00
2025-08-06 08:41:30 +02:00
2025-06-02 17:26:16 -06:00
2025-01-26 11:06:56 +01:00
2025-10-07 17:49:15 -06:00
2024-03-07 09:23:10 -05:00
2025-06-02 17:26:16 -06:00
2025-08-23 16:37:20 +02:00
2024-11-14 18:14:05 -06:00
2024-05-22 08:55:29 -06:00
2022-09-02 13:40:42 -04:00
2024-12-24 17:02:23 +01:00
2024-12-02 07:40:39 -06:00
2025-04-10 20:55:53 -06:00
2024-06-24 13:34:52 -06:00
2020-08-07 22:31:32 -04:00
2024-10-17 03:12:47 +02:00
2024-07-15 12:12:17 -06:00
2024-12-31 19:00:46 -06:00
2025-10-08 11:34:54 +02:00
2024-07-15 12:12:17 -06:00
2024-09-18 13:00:59 -06:00
2024-07-15 12:12:17 -06:00