* [PATCH v2 0/3] Don't use SBI functions in fdt code
@ 2021-05-19 7:54 Daniel Schaefer
2021-05-19 7:54 ` [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h Daniel Schaefer
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Daniel Schaefer @ 2021-05-19 7:54 UTC (permalink / raw)
To: opensbi
Second series with minor changes based on the feedback
- Made commit description of 1 better
- Changed sbi_memcpy to memcpy in 2 (forgot it before because I was
basing on v0.9 instead of master)
- Fixed typo in commit message of 3
Cc: Xiang W <wxjstz@126.com>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Anup Patel <anup.patel@wdc.com>
Daniel Schaefer (3):
lib: utils: Add strncpy macro to libfdt_env.h
lib: fdt: Don't use sbi_string functions
lib: utils: Replace strcmp with strncmp
lib/utils/fdt/fdt_domain.c | 9 +++++----
lib/utils/libfdt/libfdt_env.h | 1 +
2 files changed, 6 insertions(+), 4 deletions(-)
--
2.30.1
^ permalink raw reply [flat|nested] 11+ messages in thread* [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h 2021-05-19 7:54 [PATCH v2 0/3] Don't use SBI functions in fdt code Daniel Schaefer @ 2021-05-19 7:54 ` Daniel Schaefer 2021-05-19 8:37 ` Xiang W 2021-05-19 7:54 ` [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer 2021-05-19 7:54 ` [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp Daniel Schaefer 2 siblings, 1 reply; 11+ messages in thread From: Daniel Schaefer @ 2021-05-19 7:54 UTC (permalink / raw) To: opensbi Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e we want to use sbi_strncpy as strncpy in the OpenSBI implementation for libfdt. Cc: Abner Chang <abner.chang@hpe.com> Cc: Anup Patel <Anup.Patel@wdc.com> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Abner Chang <abner.chang@hpe.com> --- lib/utils/libfdt/libfdt_env.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/utils/libfdt/libfdt_env.h b/lib/utils/libfdt/libfdt_env.h index bc3e7588660a..f9d9c6783c52 100644 --- a/lib/utils/libfdt/libfdt_env.h +++ b/lib/utils/libfdt/libfdt_env.h @@ -31,6 +31,7 @@ #define strchr sbi_strchr #define strrchr sbi_strrchr #define strcpy sbi_strcpy +#define strncpy sbi_strncpy #define strcmp sbi_strcmp #define strncmp sbi_strncmp #define strlen sbi_strlen -- 2.30.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h 2021-05-19 7:54 ` [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h Daniel Schaefer @ 2021-05-19 8:37 ` Xiang W 2021-05-19 12:51 ` Anup Patel 0 siblings, 1 reply; 11+ messages in thread From: Xiang W @ 2021-05-19 8:37 UTC (permalink / raw) To: opensbi ? 2021-05-19?? 15:54 +0800?Daniel Schaefer??? > Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e > we want to use sbi_strncpy as strncpy in the OpenSBI implementation > for > libfdt. > > Cc: Abner Chang <abner.chang@hpe.com> > Cc: Anup Patel <Anup.Patel@wdc.com> > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > Reviewed-by: Abner Chang <abner.chang@hpe.com> Reviewed-by: Xiang W <wxjstz@126.com> > --- > lib/utils/libfdt/libfdt_env.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/utils/libfdt/libfdt_env.h > b/lib/utils/libfdt/libfdt_env.h > index bc3e7588660a..f9d9c6783c52 100644 > --- a/lib/utils/libfdt/libfdt_env.h > +++ b/lib/utils/libfdt/libfdt_env.h > @@ -31,6 +31,7 @@ > #define strchr sbi_strchr > #define strrchr sbi_strrchr > #define strcpy sbi_strcpy > +#define strncpy sbi_strncpy > #define strcmp sbi_strcmp > #define strncmp sbi_strncmp > #define strlen sbi_strlen > -- > 2.30.1 > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h 2021-05-19 8:37 ` Xiang W @ 2021-05-19 12:51 ` Anup Patel 2021-05-19 12:54 ` Anup Patel 0 siblings, 1 reply; 11+ messages in thread From: Anup Patel @ 2021-05-19 12:51 UTC (permalink / raw) To: opensbi > -----Original Message----- > From: Xiang W <wxjstz@126.com> > Sent: 19 May 2021 14:08 > To: Daniel Schaefer <daniel.schaefer@hpe.com>; > opensbi at lists.infradead.org > Cc: Abner Chang <abner.chang@hpe.com>; Anup Patel > <Anup.Patel@wdc.com> > Subject: Re: [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h > > ? 2021-05-19?? 15:54 +0800?Daniel Schaefer??? > > Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e > > we want to use sbi_strncpy as strncpy in the OpenSBI implementation > > for libfdt. > > > > Cc: Abner Chang <abner.chang@hpe.com> > > Cc: Anup Patel <Anup.Patel@wdc.com> > > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > > Reviewed-by: Abner Chang <abner.chang@hpe.com> > > Reviewed-by: Xiang W <wxjstz@126.com> Looks good to me. Reviewed-by: Anup Patel <anup.patel@wdc.com> Regards, Anup > > > --- > > lib/utils/libfdt/libfdt_env.h | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/lib/utils/libfdt/libfdt_env.h > > b/lib/utils/libfdt/libfdt_env.h index bc3e7588660a..f9d9c6783c52 > > 100644 > > --- a/lib/utils/libfdt/libfdt_env.h > > +++ b/lib/utils/libfdt/libfdt_env.h > > @@ -31,6 +31,7 @@ > > #define strchr sbi_strchr > > #define strrchr sbi_strrchr > > #define strcpy sbi_strcpy > > +#define strncpy sbi_strncpy > > #define strcmp sbi_strcmp > > #define strncmp sbi_strncmp > > #define strlen sbi_strlen > > -- > > 2.30.1 > > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h 2021-05-19 12:51 ` Anup Patel @ 2021-05-19 12:54 ` Anup Patel 0 siblings, 0 replies; 11+ messages in thread From: Anup Patel @ 2021-05-19 12:54 UTC (permalink / raw) To: opensbi > -----Original Message----- > From: Anup Patel > Sent: 19 May 2021 18:22 > To: Xiang W <wxjstz@126.com>; Daniel Schaefer > <daniel.schaefer@hpe.com>; opensbi at lists.infradead.org > Cc: Abner Chang <abner.chang@hpe.com> > Subject: RE: [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h > > > > > -----Original Message----- > > From: Xiang W <wxjstz@126.com> > > Sent: 19 May 2021 14:08 > > To: Daniel Schaefer <daniel.schaefer@hpe.com>; > > opensbi at lists.infradead.org > > Cc: Abner Chang <abner.chang@hpe.com>; Anup Patel > <Anup.Patel@wdc.com> > > Subject: Re: [PATCH v2 1/3] lib: utils: Add strncpy macro to > > libfdt_env.h > > > > ? 2021-05-19?? 15:54 +0800?Daniel Schaefer??? > > > Just like 2845d2d2cf4fb74a89452ba223995aa4a118c07e > > > we want to use sbi_strncpy as strncpy in the OpenSBI implementation > > > for libfdt. > > > > > > Cc: Abner Chang <abner.chang@hpe.com> > > > Cc: Anup Patel <Anup.Patel@wdc.com> > > > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > > > Reviewed-by: Abner Chang <abner.chang@hpe.com> > > > > Reviewed-by: Xiang W <wxjstz@126.com> > > Looks good to me. > > Reviewed-by: Anup Patel <anup.patel@wdc.com> Forgot to mention that I have applied this patch to the riscv/opensbi repo. Thanks, Anup > > Regards, > Anup > > > > > > --- > > > lib/utils/libfdt/libfdt_env.h | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/lib/utils/libfdt/libfdt_env.h > > > b/lib/utils/libfdt/libfdt_env.h index bc3e7588660a..f9d9c6783c52 > > > 100644 > > > --- a/lib/utils/libfdt/libfdt_env.h > > > +++ b/lib/utils/libfdt/libfdt_env.h > > > @@ -31,6 +31,7 @@ > > > #define strchr sbi_strchr > > > #define strrchr sbi_strrchr > > > #define strcpy sbi_strcpy > > > +#define strncpy sbi_strncpy > > > #define strcmp sbi_strcmp > > > #define strncmp sbi_strncmp > > > #define strlen sbi_strlen > > > -- > > > 2.30.1 > > > > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions 2021-05-19 7:54 [PATCH v2 0/3] Don't use SBI functions in fdt code Daniel Schaefer 2021-05-19 7:54 ` [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h Daniel Schaefer @ 2021-05-19 7:54 ` Daniel Schaefer 2021-05-19 8:38 ` Xiang W 2021-05-19 7:54 ` [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp Daniel Schaefer 2 siblings, 1 reply; 11+ messages in thread From: Daniel Schaefer @ 2021-05-19 7:54 UTC (permalink / raw) To: opensbi When SBI is built by external firmware, we need to use their functions, defined in libfdt_env.h. Just like 2cfd2fc9048806353298a1b967abf985901e36e8 Cc: Abner Chang <abner.chang@hpe.com> Cc: Anup Patel <Anup.Patel@wdc.com> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Abner Chang <abner.chang@hpe.com> --- lib/utils/fdt/fdt_domain.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c index 95c195d65238..fc8ad423eb88 100644 --- a/lib/utils/fdt/fdt_domain.c +++ b/lib/utils/fdt/fdt_domain.c @@ -9,6 +9,7 @@ */ #include <libfdt.h> +#include <libfdt_env.h> #include <sbi/sbi_domain.h> #include <sbi/sbi_error.h> #include <sbi/sbi_hartmask.h> @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, int doff, void *p) { struct __fixup_find_domain_offset_info *fdo = p; - if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) + if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) *fdo->doffset = doff; return 0; @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) regions = &fdt_regions[fdt_domains_count][0]; /* Read DT node name */ - sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), + strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), sizeof(dom->name)); dom->name[sizeof(dom->name) - 1] = '\0'; @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) /* Setup memregions from DT */ val32 = 0; - sbi_memset(regions, 0, + memset(regions, 0, sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + 1)); dom->regions = regions; err = fdt_iterate_each_memregion(fdt, domain_offset, &val32, @@ -337,7 +338,7 @@ static int __fdt_parse_domain(void *fdt, int domain_offset, void *opaque) continue; if (FDT_DOMAIN_REGION_MAX_COUNT <= val32) return SBI_EINVAL; - sbi_memcpy(®ions[val32++], reg, sizeof(*reg)); + memcpy(®ions[val32++], reg, sizeof(*reg)); } /* Read "boot-hart" DT property */ -- 2.30.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions 2021-05-19 7:54 ` [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer @ 2021-05-19 8:38 ` Xiang W 2021-05-19 12:52 ` Anup Patel 0 siblings, 1 reply; 11+ messages in thread From: Xiang W @ 2021-05-19 8:38 UTC (permalink / raw) To: opensbi ? 2021-05-19?? 15:54 +0800?Daniel Schaefer??? > When SBI is built by external firmware, we need to use their > functions, > defined in libfdt_env.h. > Just like 2cfd2fc9048806353298a1b967abf985901e36e8 > > Cc: Abner Chang <abner.chang@hpe.com> > Cc: Anup Patel <Anup.Patel@wdc.com> > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > Reviewed-by: Abner Chang <abner.chang@hpe.com> Reviewed-by: Xiang W <wxjstz@126.com> > --- > lib/utils/fdt/fdt_domain.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c > index 95c195d65238..fc8ad423eb88 100644 > --- a/lib/utils/fdt/fdt_domain.c > +++ b/lib/utils/fdt/fdt_domain.c > @@ -9,6 +9,7 @@ > */ > > #include <libfdt.h> > +#include <libfdt_env.h> > #include <sbi/sbi_domain.h> > #include <sbi/sbi_error.h> > #include <sbi/sbi_hartmask.h> > @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, > int doff, void *p) > { > struct __fixup_find_domain_offset_info *fdo = p; > > - if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) > + if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) > *fdo->doffset = doff; > > return 0; > @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int > domain_offset, void *opaque) > regions = &fdt_regions[fdt_domains_count][0]; > > /* Read DT node name */ > - sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), > + strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), > sizeof(dom->name)); > dom->name[sizeof(dom->name) - 1] = '\0'; > > @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int > domain_offset, void *opaque) > > /* Setup memregions from DT */ > val32 = 0; > - sbi_memset(regions, 0, > + memset(regions, 0, > sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + > 1)); > dom->regions = regions; > err = fdt_iterate_each_memregion(fdt, domain_offset, &val32, > @@ -337,7 +338,7 @@ static int __fdt_parse_domain(void *fdt, int > domain_offset, void *opaque) > continue; > if (FDT_DOMAIN_REGION_MAX_COUNT <= val32) > return SBI_EINVAL; > - sbi_memcpy(®ions[val32++], reg, sizeof(*reg)); > + memcpy(®ions[val32++], reg, sizeof(*reg)); > } > > /* Read "boot-hart" DT property */ > -- > 2.30.1 > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions 2021-05-19 8:38 ` Xiang W @ 2021-05-19 12:52 ` Anup Patel 2021-05-19 12:54 ` Anup Patel 0 siblings, 1 reply; 11+ messages in thread From: Anup Patel @ 2021-05-19 12:52 UTC (permalink / raw) To: opensbi > -----Original Message----- > From: Xiang W <wxjstz@126.com> > Sent: 19 May 2021 14:09 > To: Daniel Schaefer <daniel.schaefer@hpe.com>; > opensbi at lists.infradead.org > Cc: Abner Chang <abner.chang@hpe.com>; Anup Patel > <Anup.Patel@wdc.com> > Subject: Re: [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions > > ? 2021-05-19?? 15:54 +0800?Daniel Schaefer??? > > When SBI is built by external firmware, we need to use their > > functions, defined in libfdt_env.h. > > Just like 2cfd2fc9048806353298a1b967abf985901e36e8 > > > > Cc: Abner Chang <abner.chang@hpe.com> > > Cc: Anup Patel <Anup.Patel@wdc.com> > > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > > Reviewed-by: Abner Chang <abner.chang@hpe.com> > > Reviewed-by: Xiang W <wxjstz@126.com> Looks good to me. Reviewed-by: Anup Patel <anup.patel@wdc.com> Regards, Anup > > > --- > > lib/utils/fdt/fdt_domain.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c > > index 95c195d65238..fc8ad423eb88 100644 > > --- a/lib/utils/fdt/fdt_domain.c > > +++ b/lib/utils/fdt/fdt_domain.c > > @@ -9,6 +9,7 @@ > > */ > > > > #include <libfdt.h> > > +#include <libfdt_env.h> > > #include <sbi/sbi_domain.h> > > #include <sbi/sbi_error.h> > > #include <sbi/sbi_hartmask.h> > > @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, int > > doff, void *p) { > > struct __fixup_find_domain_offset_info *fdo = p; > > > > - if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) > > + if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) > > *fdo->doffset = doff; > > > > return 0; > > @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int > > domain_offset, void *opaque) > > regions = &fdt_regions[fdt_domains_count][0]; > > > > /* Read DT node name */ > > - sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), > > + strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), > > sizeof(dom->name)); > > dom->name[sizeof(dom->name) - 1] = '\0'; > > > > @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int > > domain_offset, void *opaque) > > > > /* Setup memregions from DT */ > > val32 = 0; > > - sbi_memset(regions, 0, > > + memset(regions, 0, > > sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + > 1)); > > dom->regions = regions; > > err = fdt_iterate_each_memregion(fdt, domain_offset, &val32, @@ > > -337,7 +338,7 @@ static int __fdt_parse_domain(void *fdt, int > > domain_offset, void *opaque) > > continue; > > if (FDT_DOMAIN_REGION_MAX_COUNT <= val32) > > return SBI_EINVAL; > > - sbi_memcpy(®ions[val32++], reg, sizeof(*reg)); > > + memcpy(®ions[val32++], reg, sizeof(*reg)); > > } > > > > /* Read "boot-hart" DT property */ > > -- > > 2.30.1 > > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions 2021-05-19 12:52 ` Anup Patel @ 2021-05-19 12:54 ` Anup Patel 0 siblings, 0 replies; 11+ messages in thread From: Anup Patel @ 2021-05-19 12:54 UTC (permalink / raw) To: opensbi > -----Original Message----- > From: Anup Patel > Sent: 19 May 2021 18:22 > To: 'Xiang W' <wxjstz@126.com>; Daniel Schaefer > <daniel.schaefer@hpe.com>; opensbi at lists.infradead.org > Cc: Abner Chang <abner.chang@hpe.com> > Subject: RE: [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions > > > > > -----Original Message----- > > From: Xiang W <wxjstz@126.com> > > Sent: 19 May 2021 14:09 > > To: Daniel Schaefer <daniel.schaefer@hpe.com>; > > opensbi at lists.infradead.org > > Cc: Abner Chang <abner.chang@hpe.com>; Anup Patel > <Anup.Patel@wdc.com> > > Subject: Re: [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions > > > > ? 2021-05-19?? 15:54 +0800?Daniel Schaefer??? > > > When SBI is built by external firmware, we need to use their > > > functions, defined in libfdt_env.h. > > > Just like 2cfd2fc9048806353298a1b967abf985901e36e8 > > > > > > Cc: Abner Chang <abner.chang@hpe.com> > > > Cc: Anup Patel <Anup.Patel@wdc.com> > > > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > > > Reviewed-by: Abner Chang <abner.chang@hpe.com> > > > > Reviewed-by: Xiang W <wxjstz@126.com> > > Looks good to me. > > Reviewed-by: Anup Patel <anup.patel@wdc.com> Forgot to mention that I have applied this patch to the riscv/opensbi repo. Thanks, Anup > > Regards, > Anup > > > > > > --- > > > lib/utils/fdt/fdt_domain.c | 9 +++++---- > > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > > > diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c > > > index 95c195d65238..fc8ad423eb88 100644 > > > --- a/lib/utils/fdt/fdt_domain.c > > > +++ b/lib/utils/fdt/fdt_domain.c > > > @@ -9,6 +9,7 @@ > > > */ > > > > > > #include <libfdt.h> > > > +#include <libfdt_env.h> > > > #include <sbi/sbi_domain.h> > > > #include <sbi/sbi_error.h> > > > #include <sbi/sbi_hartmask.h> > > > @@ -95,7 +96,7 @@ static int __fixup_find_domain_offset(void *fdt, > > > int doff, void *p) { > > > struct __fixup_find_domain_offset_info *fdo = p; > > > > > > - if (!sbi_strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) > > > + if (!strcmp(fdo->name, fdt_get_name(fdt, doff, NULL))) > > > *fdo->doffset = doff; > > > > > > return 0; > > > @@ -287,7 +288,7 @@ static int __fdt_parse_domain(void *fdt, int > > > domain_offset, void *opaque) > > > regions = &fdt_regions[fdt_domains_count][0]; > > > > > > /* Read DT node name */ > > > - sbi_strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), > > > + strncpy(dom->name, fdt_get_name(fdt, domain_offset, NULL), > > > sizeof(dom->name)); > > > dom->name[sizeof(dom->name) - 1] = '\0'; > > > > > > @@ -313,7 +314,7 @@ static int __fdt_parse_domain(void *fdt, int > > > domain_offset, void *opaque) > > > > > > /* Setup memregions from DT */ > > > val32 = 0; > > > - sbi_memset(regions, 0, > > > + memset(regions, 0, > > > sizeof(*regions) * (FDT_DOMAIN_REGION_MAX_COUNT + > > 1)); > > > dom->regions = regions; > > > err = fdt_iterate_each_memregion(fdt, domain_offset, &val32, @@ > > > -337,7 +338,7 @@ static int __fdt_parse_domain(void *fdt, int > > > domain_offset, void *opaque) > > > continue; > > > if (FDT_DOMAIN_REGION_MAX_COUNT <= val32) > > > return SBI_EINVAL; > > > - sbi_memcpy(®ions[val32++], reg, sizeof(*reg)); > > > + memcpy(®ions[val32++], reg, sizeof(*reg)); > > > } > > > > > > /* Read "boot-hart" DT property */ > > > -- > > > 2.30.1 > > > > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp 2021-05-19 7:54 [PATCH v2 0/3] Don't use SBI functions in fdt code Daniel Schaefer 2021-05-19 7:54 ` [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h Daniel Schaefer 2021-05-19 7:54 ` [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer @ 2021-05-19 7:54 ` Daniel Schaefer 2021-05-19 12:52 ` Anup Patel 2 siblings, 1 reply; 11+ messages in thread From: Daniel Schaefer @ 2021-05-19 7:54 UTC (permalink / raw) To: opensbi Cc: Abner Chang <abner.chang@hpe.com> Cc: Anup Patel <Anup.Patel@wdc.com> Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> Reviewed-by: Xiang W <wxjstz@126.com> Reviewed-by: Abner Chang <abner.chang@hpe.com> --- lib/utils/fdt/fdt_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c index fc8ad423eb88..676c75790829 100644 --- a/lib/utils/fdt/fdt_domain.c +++ b/lib/utils/fdt/fdt_domain.c @@ -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; -- 2.30.1 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp 2021-05-19 7:54 ` [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp Daniel Schaefer @ 2021-05-19 12:52 ` Anup Patel 0 siblings, 0 replies; 11+ messages in thread From: Anup Patel @ 2021-05-19 12:52 UTC (permalink / raw) To: opensbi > -----Original Message----- > From: Daniel Schaefer <daniel.schaefer@hpe.com> > Sent: 19 May 2021 13:24 > To: opensbi at lists.infradead.org > Cc: Abner Chang <abner.chang@hpe.com>; Anup Patel > <Anup.Patel@wdc.com>; Xiang W <wxjstz@126.com> > Subject: [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp > > Cc: Abner Chang <abner.chang@hpe.com> > Cc: Anup Patel <Anup.Patel@wdc.com> > Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> > Reviewed-by: Xiang W <wxjstz@126.com> > Reviewed-by: Abner Chang <abner.chang@hpe.com> Looks good to me. I have added some commit description at time of merging this patch. Reviewed-by: Anup Patel <anup.patel@wdc.com> Regards, Anup > --- > lib/utils/fdt/fdt_domain.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/utils/fdt/fdt_domain.c b/lib/utils/fdt/fdt_domain.c index > fc8ad423eb88..676c75790829 100644 > --- a/lib/utils/fdt/fdt_domain.c > +++ b/lib/utils/fdt/fdt_domain.c > @@ -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; > -- > 2.30.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-05-19 12:54 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-05-19 7:54 [PATCH v2 0/3] Don't use SBI functions in fdt code Daniel Schaefer 2021-05-19 7:54 ` [PATCH v2 1/3] lib: utils: Add strncpy macro to libfdt_env.h Daniel Schaefer 2021-05-19 8:37 ` Xiang W 2021-05-19 12:51 ` Anup Patel 2021-05-19 12:54 ` Anup Patel 2021-05-19 7:54 ` [PATCH v2 2/3] lib: fdt: Don't use sbi_string functions Daniel Schaefer 2021-05-19 8:38 ` Xiang W 2021-05-19 12:52 ` Anup Patel 2021-05-19 12:54 ` Anup Patel 2021-05-19 7:54 ` [PATCH v2 3/3] lib: utils: Replace strcmp with strncmp Daniel Schaefer 2021-05-19 12:52 ` Anup Patel
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox