<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Slava Abramov <slava.abramov@amd.com></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Michel Dänzer <michel@daenzer.net><br>
<b>Sent:</b> Monday, July 23, 2018 12:45:11 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> [PATCH xf86-video-amdgpu] Use strcpy for RandR output property names</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">From: Michel Dänzer <michel.daenzer@amd.com><br>
<br>
Instead of strncpy with the string length. Avoids new warnings with GCC<br>
8:<br>
<br>
../../src/drmmode_display.c: In function ‘drmmode_output_create_resources’:<br>
../../src/drmmode_display.c:2240:2: warning: ‘strncpy’ output truncated before terminating nul copying 8 bytes from a string of the same length [-Wstringop-truncation]<br>
  strncpy(tearfree_prop->name, "TearFree", 8);<br>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
../../src/drmmode_display.c:2244:2: warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]<br>
  strncpy(tearfree_prop->enums[0].name, "off", 3);<br>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
../../src/drmmode_display.c:2245:2: warning: ‘strncpy’ output truncated before terminating nul copying 2 bytes from a string of the same length [-Wstringop-truncation]<br>
  strncpy(tearfree_prop->enums[1].name, "on", 2);<br>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
../../src/drmmode_display.c:2247:2: warning: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Wstringop-truncation]<br>
  strncpy(tearfree_prop->enums[2].name, "auto", 4);<br>
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
<br>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com><br>
---<br>
 src/drmmode_display.c | 8 ++++----<br>
 1 file changed, 4 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/drmmode_display.c b/src/drmmode_display.c<br>
index b3e754005..92f58c157 100644<br>
--- a/src/drmmode_display.c<br>
+++ b/src/drmmode_display.c<br>
@@ -2211,14 +2211,14 @@ static void drmmode_output_create_resources(xf86OutputPtr output)<br>
         /* Userspace-only property for TearFree */<br>
         tearfree_prop = calloc(1, sizeof(*tearfree_prop));<br>
         tearfree_prop->flags = DRM_MODE_PROP_ENUM;<br>
-       strncpy(tearfree_prop->name, "TearFree", 8);<br>
+       strcpy(tearfree_prop->name, "TearFree");<br>
         tearfree_prop->count_enums = 3;<br>
         tearfree_prop->enums = calloc(tearfree_prop->count_enums,<br>
                                       sizeof(*tearfree_prop->enums));<br>
-       strncpy(tearfree_prop->enums[0].name, "off", 3);<br>
-       strncpy(tearfree_prop->enums[1].name, "on", 2);<br>
+       strcpy(tearfree_prop->enums[0].name, "off");<br>
+       strcpy(tearfree_prop->enums[1].name, "on");<br>
         tearfree_prop->enums[1].value = 1;<br>
-       strncpy(tearfree_prop->enums[2].name, "auto", 4);<br>
+       strcpy(tearfree_prop->enums[2].name, "auto");<br>
         tearfree_prop->enums[2].value = 2;<br>
         drmmode_output->props[j].mode_prop = tearfree_prop;<br>
         drmmode_output->props[j].value = info->tear_free;<br>
-- <br>
2.18.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>