@@ -3693,7 +3693,7 @@ test_invalid_create_userspace_config(void)
igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
/* invalid mux_regs */
- strncpy(config.uuid, uuid, sizeof(config.uuid));
+ strncpy(config.uuid, uuid, strlen(config.uuid));
config.n_mux_regs = 1;
config.mux_regs_ptr = to_user_pointer(invalid_mux_regs);
config.n_boolean_regs = 0;
@@ -3702,7 +3702,7 @@ test_invalid_create_userspace_config(void)
igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
/* empty config */
- strncpy(config.uuid, uuid, sizeof(config.uuid));
+ strncpy(config.uuid, uuid, strlen(config.uuid));
config.n_mux_regs = 0;
config.mux_regs_ptr = to_user_pointer(mux_regs);
config.n_boolean_regs = 0;
@@ -3711,7 +3711,7 @@ test_invalid_create_userspace_config(void)
igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
/* empty config with null pointers */
- strncpy(config.uuid, uuid, sizeof(config.uuid));
+ strncpy(config.uuid, uuid, strlen(config.uuid));
config.n_mux_regs = 1;
config.mux_regs_ptr = to_user_pointer(NULL);
config.n_boolean_regs = 2;
@@ -3722,7 +3722,7 @@ test_invalid_create_userspace_config(void)
igt_assert_eq(__i915_perf_add_config(drm_fd, &config), -EINVAL);
/* invalid pointers */
- strncpy(config.uuid, uuid, sizeof(config.uuid));
+ strncpy(config.uuid, uuid, strlen(config.uuid));
config.n_mux_regs = 42;
config.mux_regs_ptr = to_user_pointer((void *) 0xDEADBEEF);
config.n_boolean_regs = 0;
@@ -3809,7 +3809,7 @@ test_create_destroy_userspace_config(void)
i915_perf_remove_config(drm_fd, config_id);
memset(&config, 0, sizeof(config));
- strncpy(config.uuid, uuid, sizeof(config.uuid));
+ strncpy(config.uuid, uuid, strlen(config.uuid));
config.n_mux_regs = 1;
config.mux_regs_ptr = to_user_pointer(mux_regs);
This patch fix the following GCC Warnings: warning: ‘strncpy’ output truncated before terminating nul copying 36 bytes from a string of the same length [-Wstringop-truncation] [..] Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> --- tests/perf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)