lib: utils/fdt: Replace strcmp with strncmp
authorDaniel Schaefer <daniel.schaefer@hpe.com>
Wed, 19 May 2021 07:54:10 +0000 (15:54 +0800)
committerAnup Patel <anup@brainfault.org>
Wed, 19 May 2021 12:05:38 +0000 (17:35 +0530)
Use strncmp() instead of strcmp() in __fixup_find_domain_offset()
so that it compiles fine when linking with external firmware (such
as EDK2).

Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Abner Chang <abner.chang@hpe.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
lib/utils/fdt/fdt_domain.c

index fc8ad42..676c757 100644 (file)
@@ -96,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, int doff, void *p)
 {
        struct __fixup_find_domain_offset_info *fdo = p;
 
-       if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL)))
+       if (!strncmp(fdo->name, fdt_get_name(fdt, doff, NULL), strlen(fdo->name)))
                *fdo->doffset = doff;
 
        return 0;