All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH xf86-video-amdgpu] Use strcpy for RandR output property names
Date: Mon, 23 Jul 2018 18:45:11 +0200	[thread overview]
Message-ID: <20180723164511.21547-1-michel@daenzer.net> (raw)

From: Michel Dänzer <michel.daenzer@amd.com>

Instead of strncpy with the string length. Avoids new warnings with GCC
8:

../../src/drmmode_display.c: In function ‘drmmode_output_create_resources’:
../../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]
  strncpy(tearfree_prop->name, "TearFree", 8);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../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]
  strncpy(tearfree_prop->enums[0].name, "off", 3);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../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]
  strncpy(tearfree_prop->enums[1].name, "on", 2);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../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]
  strncpy(tearfree_prop->enums[2].name, "auto", 4);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 src/drmmode_display.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index b3e754005..92f58c157 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2211,14 +2211,14 @@ static void drmmode_output_create_resources(xf86OutputPtr output)
 	/* Userspace-only property for TearFree */
 	tearfree_prop = calloc(1, sizeof(*tearfree_prop));
 	tearfree_prop->flags = DRM_MODE_PROP_ENUM;
-	strncpy(tearfree_prop->name, "TearFree", 8);
+	strcpy(tearfree_prop->name, "TearFree");
 	tearfree_prop->count_enums = 3;
 	tearfree_prop->enums = calloc(tearfree_prop->count_enums,
 				      sizeof(*tearfree_prop->enums));
-	strncpy(tearfree_prop->enums[0].name, "off", 3);
-	strncpy(tearfree_prop->enums[1].name, "on", 2);
+	strcpy(tearfree_prop->enums[0].name, "off");
+	strcpy(tearfree_prop->enums[1].name, "on");
 	tearfree_prop->enums[1].value = 1;
-	strncpy(tearfree_prop->enums[2].name, "auto", 4);
+	strcpy(tearfree_prop->enums[2].name, "auto");
 	tearfree_prop->enums[2].value = 2;
 	drmmode_output->props[j].mode_prop = tearfree_prop;
 	drmmode_output->props[j].value = info->tear_free;
-- 
2.18.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2018-07-23 16:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-23 16:45 Michel Dänzer [this message]
     [not found] ` <20180723164511.21547-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-23 16:48   ` [PATCH xf86-video-amdgpu] Use strcpy for RandR output property names Abramov, Slava

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180723164511.21547-1-michel@daenzer.net \
    --to=michel-otuistvhuppr7s880joybq@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.