All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Michał Winiarski" <michal.winiarski@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH 3/3] drm/xe: Fix format string security warning
Date: Wed, 18 Oct 2023 09:28:01 -0400	[thread overview]
Message-ID: <ZS/dYeHQEQS/axcC@intel.com> (raw)
In-Reply-To: <20231018115826.3908905-4-michal.winiarski@intel.com>

On Wed, Oct 18, 2023 at 01:58:26PM +0200, Michał Winiarski wrote:
> While "gtidle->name" is not user-controllable string, it's still a bad
> practice to pass variable as a format string, it also causes the build
> to fail with:
> 
> drivers/gpu/drm/xe/xe_gt_idle_sysfs.c:88:26: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]
> 
> Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  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 7238e96a116cf..8df9840811cda 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.42.0
> 

      reply	other threads:[~2023-10-18 13:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 11:58 [Intel-xe] [PATCH 0/3] drm/xe: Fix building with clang Michał Winiarski
2023-10-18 11:58 ` [Intel-xe] [PATCH 1/3] drm/xe: Fix header guard warning Michał Winiarski
2023-10-18 13:27   ` Rodrigo Vivi
2023-10-18 11:58 ` [Intel-xe] [PATCH 2/3] drm/i915: Fix uninitialized variable warning Michał Winiarski
2023-10-18 13:27   ` Rodrigo Vivi
2023-10-18 16:54   ` Lucas De Marchi
2023-10-19 12:55     ` Upadhyay, Tejas
2023-10-24 10:50   ` Jani Nikula
2023-10-18 11:58 ` [Intel-xe] [PATCH 3/3] drm/xe: Fix format string security warning Michał Winiarski
2023-10-18 13:28   ` 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=ZS/dYeHQEQS/axcC@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=michal.winiarski@intel.com \
    /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.