drm/amdgpu: Fix a bug for input with double sscanf
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ras.c
index 0541196..9041453 100644 (file)
@@ -230,9 +230,8 @@ static int amdgpu_ras_debugfs_ctrl_parse_data(struct file *f,
        if (op != -1) {
 
                if (op == 3) {
-                       if (sscanf(str, "%*s %llu", &address) != 1)
-                               if (sscanf(str, "%*s 0x%llx", &address) != 1)
-                                       return -EINVAL;
+                       if (sscanf(str, "%*s %llx", &address) != 1)
+                               return -EINVAL;
 
                        data->op = op;
                        data->inject.address = address;
@@ -255,11 +254,9 @@ static int amdgpu_ras_debugfs_ctrl_parse_data(struct file *f,
                data->op = op;
 
                if (op == 2) {
-                       if (sscanf(str, "%*s %*s %*s %u %llu %llu",
-                                               &sub_block, &address, &value) != 3)
-                               if (sscanf(str, "%*s %*s %*s 0x%x 0x%llx 0x%llx",
-                                                       &sub_block, &address, &value) != 3)
-                                       return -EINVAL;
+                       if (sscanf(str, "%*s %*s %*s %x %llx %llx",
+                                  &sub_block, &address, &value) != 3)
+                               return -EINVAL;
                        data->head.sub_block_index = sub_block;
                        data->inject.address = address;
                        data->inject.value = value;