Skip to content

Commit

Permalink
drm/xe: stringify the argument to avoid potential vulnerability
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
  • Loading branch information
Carlos Santa authored and Rodrigo Vivi committed Dec 21, 2023
1 parent 5d30cfe commit 27a1a1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/xe/xe_gt_idle_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 27a1a1e

Please sign in to comment.