From: Eric Anholt <eric@anholt.net>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 1/3] Use PATH_MAX to fix some sprintf-into-short-buffers warnings.
Date: Sat, 2 Sep 2017 21:38:51 -0700 [thread overview]
Message-ID: <20170903043853.17899-1-eric@anholt.net> (raw)
Signed-off-by: Eric Anholt <eric@anholt.net>
---
This little series cleans up many compiler warnings I saw when testing
danvet's meson branch.
lib/igt_debugfs.c | 4 ++--
lib/igt_sysfs.c | 4 ++--
tests/kms_hdmi_inject.c | 2 +-
tests/pm_rpm.c | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 090b56e03555..63183e57229b 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -491,7 +491,7 @@ static void igt_pipe_crc_reset(int drm_fd)
}
while ((dirent = readdir(dir))) {
- char buf[128];
+ char buf[PATH_MAX];
if (strcmp(dirent->d_name, "crtc-") != 0)
continue;
@@ -525,7 +525,7 @@ static void igt_pipe_crc_reset(int drm_fd)
static void pipe_crc_exit_handler(int sig)
{
struct dirent *dirent;
- char buf[128];
+ char buf[PATH_MAX];
DIR *dir;
int fd;
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 15ed34be0088..9227e374bf44 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -192,7 +192,7 @@ int igt_sysfs_open_parameters(int device)
if (params < 0) { /* builtin? */
drm_version_t version;
char name[32] = "";
- char path[128];
+ char path[PATH_MAX];
memset(&version, 0, sizeof(version));
version.name_len = sizeof(name);
@@ -499,7 +499,7 @@ void kick_fbcon(bool enable)
return;
while ((de = readdir(dir))) {
- char buf[128];
+ char buf[PATH_MAX];
int fd, len;
if (strncmp(de->d_name, "vtcon", 5))
diff --git a/tests/kms_hdmi_inject.c b/tests/kms_hdmi_inject.c
index cb916acec3c1..22570a4b637a 100644
--- a/tests/kms_hdmi_inject.c
+++ b/tests/kms_hdmi_inject.c
@@ -170,7 +170,7 @@ eld_is_valid(void)
continue;
while ((snd_hda = readdir(dir))) {
- char fpath[128];
+ char fpath[PATH_MAX];
if (*snd_hda->d_name == '.' ||
strstr(snd_hda->d_name, "eld") == 0)
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 47c9f1143484..9e8cf79b5128 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -594,14 +594,14 @@ static int count_i2c_valid_edids(void)
DIR *dir;
struct dirent *dirent;
- char full_name[32];
+ char full_name[PATH_MAX];
dir = opendir("/dev/");
igt_assert(dir);
while ((dirent = readdir(dir))) {
if (strncmp(dirent->d_name, "i2c-", 4) == 0) {
- snprintf(full_name, 32, "/dev/%s", dirent->d_name);
+ sprintf(full_name, "/dev/%s", dirent->d_name);
fd = open(full_name, O_RDWR);
igt_assert_neq(fd, -1);
if (i2c_edid_is_valid(fd))
--
2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2017-09-03 4:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-03 4:38 Eric Anholt [this message]
2017-09-03 4:38 ` [PATCH i-g-t 2/3] intel_watermark: Fix a warning about "const char" return being silly Eric Anholt
2017-09-03 4:38 ` [PATCH i-g-t 3/3] intel_display_poller: Fix truncation of a test name Eric Anholt
2017-09-03 5:05 ` ✓ Fi.CI.BAT: success for series starting with [1/3] Use PATH_MAX to fix some sprintf-into-short-buffers warnings Patchwork
2017-09-03 6:02 ` ✓ Fi.CI.IGT: " Patchwork
2017-09-04 8:49 ` [PATCH i-g-t 1/3] " Daniel Vetter
2017-09-05 11:44 ` Daniel Vetter
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=20170903043853.17899-1-eric@anholt.net \
--to=eric@anholt.net \
--cc=intel-gfx@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox