From patchwork Sun Sep 3 04:38:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 9935997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 976BE603D7 for ; Sun, 3 Sep 2017 04:45:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BD362864A for ; Sun, 3 Sep 2017 04:45:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80BA928682; Sun, 3 Sep 2017 04:45:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DCDC928685 for ; Sun, 3 Sep 2017 04:45:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 280DB6E01F; Sun, 3 Sep 2017 04:45:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 0CACD6E00B for ; Sun, 3 Sep 2017 04:45:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 9E36210A15EF; Sat, 2 Sep 2017 21:45:23 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UVoqmsthAMCk; Sat, 2 Sep 2017 21:45:22 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id DFADC10A0208; Sat, 2 Sep 2017 21:45:21 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 5E2B62E2A93; Sat, 2 Sep 2017 21:38:53 -0700 (PDT) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Sat, 2 Sep 2017 21:38:51 -0700 Message-Id: <20170903043853.17899-1-eric@anholt.net> X-Mailer: git-send-email 2.14.1 Subject: [Intel-gfx] [PATCH i-g-t 1/3] Use PATH_MAX to fix some sprintf-into-short-buffers warnings. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Eric Anholt --- 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))