* [PATCH] amdgpu: replace snprintf in show functions with sysfs_emit
@ 2021-10-15 6:47 Qing Wang
2021-10-19 20:33 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Qing Wang @ 2021-10-15 6:47 UTC (permalink / raw)
To: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
Daniel Vetter, amd-gfx, dri-devel, linux-kernel
Cc: Qing Wang
show() must not use snprintf() when formatting the value to be
returned to user space.
Fix the following coccicheck warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:427:
WARNING: use scnprintf or sprintf.
Signed-off-by: Qing Wang <wangqing@vivo.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 2834981..faf4011 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -424,7 +424,7 @@ static ssize_t show_##name(struct device *dev, \
struct drm_device *ddev = dev_get_drvdata(dev); \
struct amdgpu_device *adev = drm_to_adev(ddev); \
\
- return snprintf(buf, PAGE_SIZE, "0x%08x\n", adev->field); \
+ return sysfs_emit(buf, "0x%08x\n", adev->field); \
} \
static DEVICE_ATTR(name, mode, show_##name, NULL)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] amdgpu: replace snprintf in show functions with sysfs_emit
2021-10-15 6:47 [PATCH] amdgpu: replace snprintf in show functions with sysfs_emit Qing Wang
@ 2021-10-19 20:33 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2021-10-19 20:33 UTC (permalink / raw)
To: Qing Wang
Cc: Alex Deucher, Christian König, Pan, Xinhui, David Airlie,
Daniel Vetter, amd-gfx list, Maling list - DRI developers, LKML
Applied. thanks!
On Fri, Oct 15, 2021 at 2:48 AM Qing Wang <wangqing@vivo.com> wrote:
>
> show() must not use snprintf() when formatting the value to be
> returned to user space.
>
> Fix the following coccicheck warning:
> drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:427:
> WARNING: use scnprintf or sprintf.
>
> Signed-off-by: Qing Wang <wangqing@vivo.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> index 2834981..faf4011 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> @@ -424,7 +424,7 @@ static ssize_t show_##name(struct device *dev, \
> struct drm_device *ddev = dev_get_drvdata(dev); \
> struct amdgpu_device *adev = drm_to_adev(ddev); \
> \
> - return snprintf(buf, PAGE_SIZE, "0x%08x\n", adev->field); \
> + return sysfs_emit(buf, "0x%08x\n", adev->field); \
> } \
> static DEVICE_ATTR(name, mode, show_##name, NULL)
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-19 20:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 6:47 [PATCH] amdgpu: replace snprintf in show functions with sysfs_emit Qing Wang
2021-10-19 20:33 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).