]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdgpu: fix a error injection failed issue
authorDennis Li <Dennis.Li@amd.com>
Fri, 16 Apr 2021 14:41:11 +0000 (22:41 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Apr 2021 01:36:01 +0000 (21:36 -0400)
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.

Signed-off-by: Dennis Li <Dennis.Li@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c

index 38a691a3b600bcb50ec0279d1d2c74622011ca1b..7438d4e847763fb3a0e42dc86cf689cbb76a6e49 100644 (file)
@@ -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. */