summaryrefslogtreecommitdiffstats
path: root/module/zfs/zfs_ioctl.c
diff options
context:
space:
mode:
authorTony Hutter <[email protected]>2017-06-28 10:05:16 -0700
committerBrian Behlendorf <[email protected]>2017-06-28 10:05:16 -0700
commit682ce104cdd80db4b67eea09eb0a90324c5f98ee (patch)
tree3fa2067633f5c089685600f25601af0f791bfcaf /module/zfs/zfs_ioctl.c
parentcda0317e4d2a1277b328e4fc42ee3699bbe46c12 (diff)
GCC 7.1 fixes
GCC 7.1 with will warn when we're not checking the snprintf() return code in cases where the buffer could be truncated. This patch either checks the snprintf return code (where applicable), or simply disables the warnings (ztest.c). Reviewed-by: Chunwei Chen <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #6253
Diffstat (limited to 'module/zfs/zfs_ioctl.c')
-rw-r--r--module/zfs/zfs_ioctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/zfs/zfs_ioctl.c b/module/zfs/zfs_ioctl.c
index 8cdfe31a2..a2f7f045f 100644
--- a/module/zfs/zfs_ioctl.c
+++ b/module/zfs/zfs_ioctl.c
@@ -3628,8 +3628,10 @@ zfs_ioc_destroy(zfs_cmd_t *zc)
*/
char namebuf[ZFS_MAX_DATASET_NAME_LEN + 6];
- (void) snprintf(namebuf, sizeof (namebuf),
- "%s/%s", zc->zc_name, recv_clone_name);
+ if (snprintf(namebuf, sizeof (namebuf), "%s/%s",
+ zc->zc_name, recv_clone_name) >=
+ sizeof (namebuf))
+ return (SET_ERROR(EINVAL));
/*
* Try to remove the hidden child (%recv) and after