[Intel-xe] drm/xe: stringify the argument to avoid potential vulnerability
Rodrigo Vivi
rodrigo.vivi at intel.com
Fri Nov 3 17:36:30 UTC 2023
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 at intel.com>
> Signed-off-by: Carlos Santa <carlos.santa at intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi at 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
>
More information about the Intel-xe
mailing list