Skip to contentSkip to conversation

lib: sbi: Fix sbi_strnlen wrong count decrement

PATCH New Rahul Pathak 2 participants 3 messages Sep 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: sbi: Fix sbi_strnlen wrong count decrement

count(maxlen) should not be decremented here

Fixes 1901e8a287bc ("platform: Add minimal libc support.")
---
 lib/sbi/sbi_string.c | 1 -
 1 file changed, 1 deletion(-)
lib/sbi/sbi_string.c +0 -1
index c163f3176506..9ebea693d0f6 100644
@@ -59,7 +59,6 @@ size_t sbi_strnlen(const char *str, size_t count)
 	while (*str != '\0' && ret < count) {
 		ret++;
 		str++;
-		count--;
 	}
 
 	return ret;
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 lib: sbi: Fix sbi_strnlen wrong count decrement

Quoted 5 lines · Rahul Pathak

count(maxlen) should not be decremented here

Fixes 1901e8a287bc ("platform: Add minimal libc support.")

This one slipped through our reviews. Thanks for catching.

Regards,
Anup

Quoted 24 lines
---
 lib/sbi/sbi_string.c | 1 -
 1 file changed, 1 deletion(-)
lib/sbi/sbi_string.c +0 -2
index c163f3176506..9ebea693d0f6 100644
@@ -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

#2 lore raw

PATCH 1/1 lib: sbi: Fix sbi_strnlen wrong count decrement

Quoted 11 lines · Anup Patel
Quoted 5 lines · Rahul Pathak

count(maxlen) should not be decremented here

Fixes 1901e8a287bc ("platform: Add minimal libc support.")

This one slipped through our reviews. Thanks for catching.

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

Regards,
Anup

Quoted 28 lines

Regards,
Anup

Quoted 24 lines
---
 lib/sbi/sbi_string.c | 1 -
 1 file changed, 1 deletion(-)
lib/sbi/sbi_string.c +0 -2
index c163f3176506..9ebea693d0f6 100644
@@ -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