[PATCH] drm/amdgpu: Fix ras debugfs data parse
Xu, Feifei
Feifei.Xu at amd.com
Mon Mar 11 10:32:50 UTC 2019
Reviewed-by: Feifei Xu <Feifei.Xu at amd.com<mailto:Feifei.Xu at amd.com>>
From: Pan, Xinhui <Xinhui.Pan at amd.com>
Sent: Monday, March 11, 2019 6:26 PM
To: amd-gfx at lists.freedesktop.org
Cc: Xu, Feifei <Feifei.Xu at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: [PATCH] drm/amdgpu: Fix ras debugfs data parse
Unzero char is accepted by sscanf, so when data is structure but
unexpectedly return error invalid;
Signed-off-by: xinhui pan <xinhui.pan at amd.com<mailto:xinhui.pan at amd.com>>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 74a65a61fd23..a5336d16aa4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -241,7 +241,7 @@ static int amdgpu_ras_debugfs_ctrl_parse_data(struct file *f,
op = 1;
else if (sscanf(str, "inject %32s %8s", block_name, err) == 2)
op = 2;
- else if (sscanf(str, "%32s", block_name) == 1)
+ else if (str[0] && str[1] && str[2] && str[3])
/* ascii string, but commands are not matched. */
return -EINVAL;
--
2.17.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190311/ea33f1de/attachment.html>
More information about the amd-gfx
mailing list