diff --git a/module/zfs/spa.c b/module/zfs/spa.c index a21b0decf6a3..b489266e0556 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -1460,11 +1460,12 @@ spa_taskq_read_param(ZFS_MODULE_PARAM_ARGS) int err = 0; if (req->newptr == NULL) { + struct sbuf s; int len = spa_taskq_param_get(ZIO_TYPE_READ, buf); - struct sbuf *s = sbuf_new_for_sysctl(NULL, NULL, len+1, req); - sbuf_cpy(s, buf); - err = sbuf_finish(s); - sbuf_delete(s); + + (void) sbuf_new_for_sysctl(&s, buf, len + 1, req); + err = sbuf_finish(&s); + sbuf_delete(&s); return (err); } @@ -1481,11 +1482,12 @@ spa_taskq_write_param(ZFS_MODULE_PARAM_ARGS) int err = 0; if (req->newptr == NULL) { + struct sbuf s; int len = spa_taskq_param_get(ZIO_TYPE_WRITE, buf); - struct sbuf *s = sbuf_new_for_sysctl(NULL, NULL, len+1, req); - sbuf_cpy(s, buf); - err = sbuf_finish(s); - sbuf_delete(s); + + (void) sbuf_new_for_sysctl(&s, buf, len + 1, req); + err = sbuf_finish(&s); + sbuf_delete(&s); return (err); }