From: mwleeds@mailtundra.com Date: Sun, 7 Apr 2024 01:47:26 +0000 (-0700) Subject: zfs: Add a comment to clarify nvlist memory layout X-Git-Url: http://git.dujemihanovic.xyz/img/%7B%7B%20%24image.RelPermalink%20%7D%7D?a=commitdiff_plain;h=6bbd7e820d3eba14eceb46c3bb42bfad1af6be3f;p=u-boot.git zfs: Add a comment to clarify nvlist memory layout Signed-off-by: Phaedrus Leeds --- diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c index 14779dee32..61d58fce68 100644 --- a/fs/zfs/zfs.c +++ b/fs/zfs/zfs.c @@ -1617,6 +1617,11 @@ zfs_nvlist_lookup_nvlist(char *nvlist, char *name) &size, 0); if (!found) return 0; + + /* Allocate 12 bytes in addition to the nvlist size: One uint32 before the + * nvlist to hold the encoding method, and two zero uint32's after the + * nvlist as the NULL terminator. + */ ret = calloc(1, size + 3 * sizeof(uint32_t)); if (!ret) return 0;