Fedora 28: Fix misc bounds check compiler warnings

Fix a bunch of (mostly) sprintf/snprintf truncation compiler
warnings that show up on Fedora 28 (GCC 8.0.1).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #7361
Closes #7368
This commit is contained in:
Tony Hutter
2018-04-04 10:16:47 -07:00
parent fd01167ffd
commit f5ecab3aef
10 changed files with 80 additions and 39 deletions
+5 -4
View File
@@ -289,10 +289,11 @@ zpios_setup_run(run_args_t **run_args, zpios_cmd_t *kcmd, struct file *file)
ra = vmem_zalloc(size, KM_SLEEP);
*run_args = ra;
strncpy(ra->pool, kcmd->cmd_pool, ZPIOS_NAME_SIZE - 1);
strncpy(ra->pre, kcmd->cmd_pre, ZPIOS_PATH_SIZE - 1);
strncpy(ra->post, kcmd->cmd_post, ZPIOS_PATH_SIZE - 1);
strncpy(ra->log, kcmd->cmd_log, ZPIOS_PATH_SIZE - 1);
snprintf(ra->pool, sizeof (ra->pool), "%s", kcmd->cmd_pool);
snprintf(ra->pre, sizeof (ra->pre), "%s", kcmd->cmd_pre);
snprintf(ra->post, sizeof (ra->post), "%s", kcmd->cmd_post);
snprintf(ra->log, sizeof (ra->log), "%s", kcmd->cmd_log);
ra->id = kcmd->cmd_id;
ra->chunk_size = kcmd->cmd_chunk_size;
ra->thread_count = kcmd->cmd_thread_count;