]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
zfs: Add a comment to clarify nvlist memory layout
authormwleeds@mailtundra.com <mwleeds@mailtundra.com>
Sun, 7 Apr 2024 01:47:26 +0000 (18:47 -0700)
committerTom Rini <trini@konsulko.com>
Wed, 17 Apr 2024 16:08:51 +0000 (10:08 -0600)
Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
fs/zfs/zfs.c

index 14779dee32d834de2d026b563f52a75448173a4c..61d58fce68dc6c8e4204f18e8f8a22a1825b5990 100644 (file)
@@ -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;