OpenSBI Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Pathak <rpathak@ventanamicro.com>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: sbi: Fix sbi_strnlen wrong count decrement
Date: Tue, 13 Sep 2022 15:17:08 +0530	[thread overview]
Message-ID: <20220913094708.2089724-1-rpathak@ventanamicro.com> (raw)

count(maxlen) should not be decremented here

Fixes: 1901e8a287bc ("platform: Add minimal libc support.")
Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com>
---
 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



             reply	other threads:[~2022-09-13  9:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13  9:47 Rahul Pathak [this message]
2022-09-13 10:52 ` [PATCH] lib: sbi: Fix sbi_strnlen wrong count decrement Anup Patel
2022-09-13 11:58   ` Anup Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220913094708.2089724-1-rpathak@ventanamicro.com \
    --to=rpathak@ventanamicro.com \
    --cc=opensbi@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox