From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Carlos Santa <carlos.santa@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] drm/xe: stringify the argument to avoid potential vulnerability
Date: Fri, 3 Nov 2023 13:36:30 -0400 [thread overview]
Message-ID: <ZUUvnq1Hv3Tzx3D6@intel.com> (raw)
In-Reply-To: <20231026220127.3406918-1-carlos.santa@intel.com>
On Thu, Oct 26, 2023 at 03:01:27PM -0700, Carlos Santa wrote:
> This error gets printed inside a sandbox with warnings turned on.
>
> /mnt/host/source/src/third_party/kernel/v5.15/drivers/
> gpu/drm/xe/xe_gt_idle_sysfs.c:87:26: error: format string is
> not a string literal (potentially insecure) [-Werror,-Wformat-security]
> return sysfs_emit(buff, gtidle->name);
> ^~~~~~~~~~~~
> /mnt/host/source/src/third_party/kernel/v5.15/drivers/
> gpu/drm/xe/xe_gt_idle_sysfs.c:87:26: note: treat the string
> as an argument to avoid this
> return sysfs_emit(buff, gtidle->name);
> ^
> "%s",
> 1 error generated.
>
> CC: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Carlos Santa <carlos.santa@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
and pushed. thanks for the patch
> ---
> drivers/gpu/drm/xe/xe_gt_idle_sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_idle_sysfs.c b/drivers/gpu/drm/xe/xe_gt_idle_sysfs.c
> index 7238e96a116c..8df9840811cd 100644
> --- a/drivers/gpu/drm/xe/xe_gt_idle_sysfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_idle_sysfs.c
> @@ -85,7 +85,7 @@ static ssize_t name_show(struct device *dev,
> {
> struct xe_gt_idle *gtidle = dev_to_gtidle(dev);
>
> - return sysfs_emit(buff, gtidle->name);
> + return sysfs_emit(buff, "%s\n", gtidle->name);
> }
> static DEVICE_ATTR_RO(name);
>
> --
> 2.25.1
>
prev parent reply other threads:[~2023-11-03 17:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-26 22:01 [Intel-xe] drm/xe: stringify the argument to avoid potential vulnerability Carlos Santa
2023-10-26 22:07 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-10-26 22:07 ` [Intel-xe] ✓ CI.checkpatch: " Patchwork
2023-10-26 22:08 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-10-26 22:15 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-10-26 22:16 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-10-26 22:17 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-10-26 22:51 ` [Intel-xe] ✓ CI.BAT: " Patchwork
2023-11-03 17:36 ` Rodrigo Vivi [this message]
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=ZUUvnq1Hv3Tzx3D6@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=carlos.santa@intel.com \
--cc=intel-xe@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