From: Matthew Auld <matthew.auld@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH i-g-t 1/3] lib/igt_device_scan: fix dangling pointer
Date: Tue, 28 Jun 2022 14:13:16 +0100 [thread overview]
Message-ID: <20220628131318.197965-1-matthew.auld@intel.com> (raw)
It looks like the linkto is out of scope:
../lib/igt_device_scan.c: In function ‘igt_device_add_attr’:
../lib/igt_device_scan.c:368:57: warning: dangling pointer ‘v’ to ‘linkto’ may be used [-Wdangling-pointer=]
368 | g_hash_table_insert(dev->attrs_ht, strdup(key), strdup(v));
| ^~~~~~~~~
../lib/igt_device_scan.c:351:22: note: ‘linkto’ declared here
351 | char linkto[PATH_MAX];
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
---
lib/igt_device_scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index a1cee7a4..5d1d4258 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -338,6 +338,7 @@ static void igt_device_add_attr(struct igt_device *dev,
const char *key, const char *value)
{
const char *v = value;
+ char linkto[PATH_MAX];
if (!key)
return;
@@ -348,7 +349,6 @@ static void igt_device_add_attr(struct igt_device *dev,
if (!v) {
struct stat st;
char path[PATH_MAX];
- char linkto[PATH_MAX];
int len;
snprintf(path, sizeof(path), "%s/%s", dev->syspath, key);
--
2.36.1
next reply other threads:[~2022-06-28 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-28 13:13 Matthew Auld [this message]
2022-06-28 13:13 ` [Intel-gfx] [PATCH i-g-t 2/3] tests/kms_cursor_crc: fix truncated warning Matthew Auld
2022-06-28 13:13 ` [Intel-gfx] [PATCH i-g-t 3/3] tests/amdgpu/amdgpu_command_submission: fix uaf Matthew Auld
2022-06-29 8:55 ` Gwan-gyeong Mun
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=20220628131318.197965-1-matthew.auld@intel.com \
--to=matthew.auld@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--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