From 5aea3644d6aef3fe636053d6924bc0803fbd75b5 Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Thu, 2 Apr 2015 02:09:20 +1100 Subject: [PATCH] Illumos 5038 - Remove "old-style" flexible array usage in ZFS. 5038 Remove "old-style" flexible array usage in ZFS. Author: Justin T. Gibbs Reviewed by: Matthew Ahrens Reviewed by: Josef 'Jeff' Sipek Approved by: Richard Lowe References: https://www.illumos.org/issues/5038 https://github.com/illumos/illumos-gate/commit/7f18da4 Ported-by: Chris Dunlop Signed-off-by: Brian Behlendorf --- include/sys/dnode.h | 2 +- module/zfs/dnode.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sys/dnode.h b/include/sys/dnode.h index 8a72722eb2..2974a20dc6 100644 --- a/include/sys/dnode.h +++ b/include/sys/dnode.h @@ -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 { diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 41722f25c0..7c28dc64d1 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -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; } }