drm/i915/perf: Fix compiler warning for string truncation

"Linux Kernel Mailing List" <[email protected]> Fri, 16 Feb 2018 17:15:05 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/73b0fcd24ef1b8e20b7f6e6babcde540d96d0cb2
Commit:     73b0fcd24ef1b8e20b7f6e6babcde540d96d0cb2
Parent:     75b0e73023ef7994348d619e9adadab0e96bb195
Refname:    refs/heads/master
Author:     Chris Wilson <[email protected]>
AuthorDate: Thu Feb 8 10:24:03 2018 +0000
Committer:  Rodrigo Vivi <[email protected]>
CommitDate: Mon Feb 12 23:34:55 2018 -0800

    drm/i915/perf: Fix compiler warning for string truncation
    
    drivers/gpu/drm/i915/i915_oa_cnl.c: In function ‘i915_perf_load_test_config_cnl’:
    drivers/gpu/drm/i915/i915_oa_cnl.c:99:2: error: ‘strncpy’ output truncated before terminating nul copying 36 bytes from a string of the same length [-Werror=stringop-truncation]
    
    v2: strlcpy
    
    Fixes: 95690a02fb5d ("drm/i915/perf: enable perf support on CNL")
    Signed-off-by: Chris Wilson <[email protected]>
    Cc: Lionel Landwerlin <[email protected]>
    Cc: Matthew Auld <[email protected]>
    Reviewed-by: Lionel Landwerlin <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    (cherry picked from commit 020580ff8edd50e64ae1bf47e560c61e5e2f29fc)
    Signed-off-by: Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/i915_oa_cnl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_oa_cnl.c b/drivers/gpu/drm/i915/i915_oa_cnl.c
index ff0ac3627cc4..ba9140c87cc0 100644
--- a/drivers/gpu/drm/i915/i915_oa_cnl.c
+++ b/drivers/gpu/drm/i915/i915_oa_cnl.c
@@ -96,9 +96,9 @@ show_test_oa_id(struct device *kdev, struct device_attribute *attr, char *buf)
 void
 i915_perf_load_test_config_cnl(struct drm_i915_private *dev_priv)
 {
-	strncpy(dev_priv->perf.oa.test_config.uuid,
+	strlcpy(dev_priv->perf.oa.test_config.uuid,
 		"db41edd4-d8e7-4730-ad11-b9a2d6833503",
-		UUID_STRING_LEN);
+		sizeof(dev_priv->perf.oa.test_config.uuid));
 	dev_priv->perf.oa.test_config.id = 1;
 
 	dev_priv->perf.oa.test_config.mux_regs = mux_config_test_oa;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html