mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
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 <david.chen@osnexus.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Tony Hutter <hutter2@llnl.gov> Closes #6253
This commit is contained in:
committed by
Brian Behlendorf
parent
cda0317e4d
commit
682ce104cd
@@ -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
|
||||
|
||||
+2
-5
@@ -2154,14 +2154,12 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
|
||||
{
|
||||
zvol_state_t *zv, *zv_next;
|
||||
int oldnamelen, newnamelen;
|
||||
char *name;
|
||||
|
||||
if (zvol_inhibit_dev)
|
||||
return;
|
||||
|
||||
oldnamelen = strlen(oldname);
|
||||
newnamelen = strlen(newname);
|
||||
name = kmem_alloc(MAXNAMELEN, KM_SLEEP);
|
||||
|
||||
mutex_enter(&zvol_state_lock);
|
||||
|
||||
@@ -2181,18 +2179,17 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
|
||||
} else if (strncmp(zv->zv_name, oldname, oldnamelen) == 0 &&
|
||||
(zv->zv_name[oldnamelen] == '/' ||
|
||||
zv->zv_name[oldnamelen] == '@')) {
|
||||
snprintf(name, MAXNAMELEN, "%s%c%s", newname,
|
||||
char *name = kmem_asprintf("%s%c%s", newname,
|
||||
zv->zv_name[oldnamelen],
|
||||
zv->zv_name + oldnamelen + 1);
|
||||
zvol_rename_minor(zv, name);
|
||||
kmem_free(name, strlen(name + 1));
|
||||
}
|
||||
|
||||
mutex_exit(&zv->zv_state_lock);
|
||||
}
|
||||
|
||||
mutex_exit(&zvol_state_lock);
|
||||
|
||||
kmem_free(name, MAXNAMELEN);
|
||||
}
|
||||
|
||||
typedef struct zvol_snapdev_cb_arg {
|
||||
|
||||
Reference in New Issue
Block a user