public inbox for linux-efi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: libstub: add strnlen() implementation
@ 2016-02-16 15:29 Ard Biesheuvel
       [not found] ` <1455636559-7542-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Ard Biesheuvel @ 2016-02-16 15:29 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA,
	matt-mF/unelCI9GS6iBeEJttW/XRex20P6io
  Cc: Ard Biesheuvel

Commit 91feabc2e224 ("scripts/dtc: Update to upstream commit
b06e55c88b9b") introduces references to the strnlen() string function,
which is not currently defined in the EFI stub. So add it to our string.c

Signed-off-by: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/firmware/efi/libstub/string.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/firmware/efi/libstub/string.c b/drivers/firmware/efi/libstub/string.c
index 09d5a0894343..d4055ab80116 100644
--- a/drivers/firmware/efi/libstub/string.c
+++ b/drivers/firmware/efi/libstub/string.c
@@ -55,3 +55,19 @@ int strncmp(const char *cs, const char *ct, size_t count)
 	return 0;
 }
 #endif
+
+#ifndef __HAVE_ARCH_STRNLEN
+/**
+ * strnlen - Find the length of a length-limited string
+ * @s: The string to be sized
+ * @count: The maximum number of bytes to search
+ */
+size_t strnlen(const char *s, size_t count)
+{
+	const char *sc;
+
+	for (sc = s; count-- && *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+#endif
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-18 14:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 15:29 [PATCH] efi: libstub: add strnlen() implementation Ard Biesheuvel
     [not found] ` <1455636559-7542-1-git-send-email-ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-02-18 11:04   ` Matt Fleming
     [not found]     ` <20160218110446.GD2651-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-02-18 11:05       ` Ard Biesheuvel
     [not found]         ` <CAKv+Gu_bhat3RjoLDqUtUBG7bB0ECAdS1i4GF_AU9h=YfWz=tw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-02-18 13:33           ` Matt Fleming
     [not found]             ` <20160218133337.GF2651-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-02-18 14:01               ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox