On 11/17/25 11:55 AM, Heinrich Schuchardt wrote:
On 11/13/25 10:33, Kory Maincent wrote:
From: "Kory Maincent (TI.com)" <[email protected]>
[...]
---
Change in v2:
- Extract calloc and snprintf of the if condition.
---
boot/pxe_utils.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 038416203fc..7549a93bdad 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -473,18 +473,18 @@ static void label_boot_extension(struct
pxe_context *ctx,
else
slash = "";
- dir_len = strlen(label->fdtdir) + strlen(slash) + 1;
- overlay_dir = calloc(1, len);
- if (!overlay_dir)
- return;
-
- snprintf(overlay_dir, dir_len, "%s%s", label->fdtdir,
- slash);
+ dir_len = len + strlen(slash) + 1;
This line could be moved after the else branch to simplify the code by
avoiding separate assignments to dir_len.
We need to init len to 0 for that to work when label->fdtdir is NULL.
Cheers,
Quentin