[PATCH 4/8] lib/string.c: introduce memdup_nul() helper
Simon Glass
sjg at chromium.org
Mon Apr 13 16:57:15 CEST 2026
On 2026-04-12T19:59:41, Rasmus Villemoes <ravi at prevas.dk> wrote:
> lib/string.c: introduce memdup_nul() helper
>
> This is completely analogous to the linux kernel's kmemdup_nul()
> helper, apart from the lack of the gfp_t argument: Allocate a buffer
> of size {len}+1, copy {len} bytes from the given buffer, and add a
> final nul byte.
>
> This pattern exists in a number of places, so this helper can reduce
> some boilerplate code.
>
> Signed-off-by: Rasmus Villemoes <ravi at prevas.dk>
>
> include/linux/string.h | 13 +++++++++++++
> lib/string.c | 15 +++++++++++++++
> 2 files changed, 28 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list