[PATCH] lib: sbi: Fix sbi_strnlen wrong count decrement

Anup Patel anup at brainfault.org
Tue Sep 13 04:58:22 PDT 2022


On Tue, Sep 13, 2022 at 4:22 PM Anup Patel <anup at brainfault.org> wrote:
>
> On Tue, Sep 13, 2022 at 3:21 PM Rahul Pathak <rpathak at ventanamicro.com> wrote:
> >
> > count(maxlen) should not be decremented here
> >
> > Fixes: 1901e8a287bc ("platform: Add minimal libc support.")
> > Signed-off-by: Rahul Pathak <rpathak at ventanamicro.com>
>
> This one slipped through our reviews. Thanks for catching.
>
> Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this patch immediately since it affects FDT parsing of
certain DT properties (such as "reg-names").

Regards,
Anup

>
> Regards,
> Anup
>
> > ---
> >  lib/sbi/sbi_string.c | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/lib/sbi/sbi_string.c b/lib/sbi/sbi_string.c
> > index c163f3176506..9ebea693d0f6 100644
> > --- a/lib/sbi/sbi_string.c
> > +++ b/lib/sbi/sbi_string.c
> > @@ -59,7 +59,6 @@ size_t sbi_strnlen(const char *str, size_t count)
> >         while (*str != '\0' && ret < count) {
> >                 ret++;
> >                 str++;
> > -               count--;
> >         }
> >
> >         return ret;
> > --
> > 2.34.1
> >
> >
> > --
> > opensbi mailing list
> > opensbi at lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list