]> git.baikalelectronics.ru Git - uboot.git/commitdiff
eficonfig: use u16_strsize() to get u16 string buffer size
authorMasahisa Kojima <masahisa.kojima@linaro.org>
Fri, 2 Dec 2022 04:59:34 +0000 (13:59 +0900)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 2 Dec 2022 18:17:25 +0000 (19:17 +0100)
Use u16_strsize() to simplify the u16 string buffer
size calculation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
cmd/eficonfig.c

index 5529edc85e582b55356ab5c7e88834af6c8a24ba..88d507d04ce047f7d173dbb9f77c9ab09adbf615 100644 (file)
@@ -452,8 +452,7 @@ struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_
        struct efi_device_path *dp;
        struct efi_device_path_file_path *fp;
 
-       fp_size = sizeof(struct efi_device_path) +
-                 ((u16_strlen(current_path) + 1) * sizeof(u16));
+       fp_size = sizeof(struct efi_device_path) + u16_strsize(current_path);
        buf = calloc(1, fp_size + sizeof(END));
        if (!buf)
                return NULL;