]> granicus.if.org Git - zfs/commitdiff
Illumos 5038 - Remove "old-style" flexible array usage in ZFS.
authorJustin T. Gibbs <justing@spectralogic.com>
Wed, 1 Apr 2015 15:09:20 +0000 (02:09 +1100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 28 Apr 2015 23:24:24 +0000 (16:24 -0700)
5038 Remove "old-style" flexible array usage in ZFS.
Author: Justin T. Gibbs <justing@spectralogic.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>

References:
  https://www.illumos.org/issues/5038
  https://github.com/illumos/illumos-gate/commit/7f18da4

Ported-by: Chris Dunlop <chris@onthe.net.au>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
include/sys/dnode.h
module/zfs/dnode.c

index 8a72722eb2798cc756c7976bdb04aa25b51df56b..2974a20dc6d841258cbc24cceac1399ecbdaf2f5 100644 (file)
@@ -267,7 +267,7 @@ typedef struct dnode_handle {
 
 typedef struct dnode_children {
        size_t dnc_count;               /* number of children */
-       dnode_handle_t dnc_children[1]; /* sized dynamically */
+       dnode_handle_t dnc_children[];  /* sized dynamically */
 } dnode_children_t;
 
 typedef struct free_range {
index 41722f25c0d8d273fd057daede61b3ac1d5abf1d..7c28dc64d1a955166ed0b0663213dce873479187 100644 (file)
@@ -1022,7 +1022,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *arg)
                dnh->dnh_dnode = NULL;
        }
        kmem_free(children_dnodes, sizeof (dnode_children_t) +
-           (epb - 1) * sizeof (dnode_handle_t));
+           epb * sizeof (dnode_handle_t));
 }
 
 /*
@@ -1107,7 +1107,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
                int i;
                dnode_children_t *winner;
                children_dnodes = kmem_alloc(sizeof (dnode_children_t) +
-                   (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP);
+                   epb * sizeof (dnode_handle_t), KM_SLEEP);
                children_dnodes->dnc_count = epb;
                dnh = &children_dnodes->dnc_children[0];
                for (i = 0; i < epb; i++) {
@@ -1122,7 +1122,7 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag,
                        }
 
                        kmem_free(children_dnodes, sizeof (dnode_children_t) +
-                           (epb - 1) * sizeof (dnode_handle_t));
+                           epb * sizeof (dnode_handle_t));
                        children_dnodes = winner;
                }
        }