drm/amdgpu: fix a error injection failed issue
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix a error injection failed issue
because "sscanf(str, "retire_page")" always return 0, if application use the raw data for error injection, it always wrongly falls into "op == 3". Change to use strstr instead.
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
@@ -221,7 +221,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, "retire_page") == 0) + else if (strstr(str, "retire_page") != NULL) op =3 ; else if (str[0] && str[1] && str[2] && str[3])/* ascii string, but commands are not matched. */
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
[AMD Public Use]
Regards,
Hawking
-----Original Message-----
From: Dennis Li <[email protected]>
Sent: Friday, April 16, 2021 22:49
To: [email protected]; Deucher, Alexander <[email protected]>; Kuehling, Felix <[email protected]>; Zhang, Hawking <[email protected]>; Koenig, Christian <[email protected]>
Cc: Li, Dennis <[email protected]>
Subject: [PATCH] drm/amdgpu: fix a error injection failed issue
because "sscanf(str, "retire_page")" always return 0, if application use the raw data for error injection, it always wrongly falls into "op == 3". Change to use strstr instead.
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -1
@@ -221,7 +221,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, "retire_page") == 0) + else if (strstr(str, "retire_page") != NULL) op =3 ; else if (str[0] && str[1] && str[2] && str[3])/* ascii string, but commands are not matched. */
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx