diff --git a/module/lua/lfunc.h b/module/lua/lfunc.h index 59a4fa75c4..638971bdd0 100644 --- a/module/lua/lfunc.h +++ b/module/lua/lfunc.h @@ -13,10 +13,10 @@ #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ - cast(int, sizeof(TValue)*((n)-1))) + cast(int, sizeof(TValue)*((n)))) #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ - cast(int, sizeof(TValue *)*((n)-1))) + cast(int, sizeof(TValue *)*((n)))) LUAI_FUNC Proto *luaF_newproto (lua_State *L); diff --git a/module/lua/lobject.h b/module/lua/lobject.h index a16b8d62eb..ede697cfc5 100644 --- a/module/lua/lobject.h +++ b/module/lua/lobject.h @@ -514,14 +514,14 @@ typedef struct UpVal { typedef struct CClosure { ClosureHeader; lua_CFunction f; - TValue upvalue[1]; /* list of upvalues */ + TValue upvalue[]; /* list of upvalues */ } CClosure; typedef struct LClosure { ClosureHeader; struct Proto *p; - UpVal *upvals[1]; /* list of upvalues */ + UpVal *upvals[]; /* list of upvalues */ } LClosure; diff --git a/module/os/freebsd/zfs/zfs_debug.c b/module/os/freebsd/zfs/zfs_debug.c index dad342b06f..b75cf09218 100644 --- a/module/os/freebsd/zfs/zfs_debug.c +++ b/module/os/freebsd/zfs/zfs_debug.c @@ -30,7 +30,7 @@ typedef struct zfs_dbgmsg { list_node_t zdm_node; time_t zdm_timestamp; int zdm_size; - char zdm_msg[1]; /* variable length allocation */ + char zdm_msg[]; } zfs_dbgmsg_t; list_t zfs_dbgmsgs; @@ -159,7 +159,7 @@ __zfs_dbgmsg(char *buf) DTRACE_PROBE1(zfs__dbgmsg, char *, buf); - size = sizeof (zfs_dbgmsg_t) + strlen(buf); + size = sizeof (zfs_dbgmsg_t) + strlen(buf) + 1; zdm = kmem_zalloc(size, KM_SLEEP); zdm->zdm_size = size; zdm->zdm_timestamp = gethrestime_sec(); diff --git a/module/os/linux/zfs/zfs_debug.c b/module/os/linux/zfs/zfs_debug.c index 98c9923d59..5958063731 100644 --- a/module/os/linux/zfs/zfs_debug.c +++ b/module/os/linux/zfs/zfs_debug.c @@ -30,7 +30,7 @@ typedef struct zfs_dbgmsg { procfs_list_node_t zdm_node; uint64_t zdm_timestamp; int zdm_size; - char zdm_msg[1]; /* variable length allocation */ + char zdm_msg[]; /* variable length allocation */ } zfs_dbgmsg_t; procfs_list_t zfs_dbgmsgs; @@ -134,7 +134,7 @@ __set_error(const char *file, const char *func, int line, int err) void __zfs_dbgmsg(char *buf) { - int size = sizeof (zfs_dbgmsg_t) + strlen(buf); + int size = sizeof (zfs_dbgmsg_t) + strlen(buf) + 1; zfs_dbgmsg_t *zdm = kmem_zalloc(size, KM_SLEEP); zdm->zdm_size = size; zdm->zdm_timestamp = gethrestime_sec(); diff --git a/module/zfs/vdev_indirect.c b/module/zfs/vdev_indirect.c index 8762855d46..9e4c115f21 100644 --- a/module/zfs/vdev_indirect.c +++ b/module/zfs/vdev_indirect.c @@ -270,7 +270,7 @@ typedef struct indirect_split { */ indirect_child_t *is_good_child; - indirect_child_t is_child[1]; /* variable-length */ + indirect_child_t is_child[]; } indirect_split_t; /*