]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amd/pm: Check SMUv13.0.6/12 metrics integrity
authorLijo Lazar <lijo.lazar@amd.com>
Sat, 18 Apr 2026 00:51:17 +0000 (06:21 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Apr 2026 20:51:16 +0000 (16:51 -0400)
Check if data fetch is proper by matching the first few bytes against
0xFFs. If 0xFFs, that means data couldn't be read properly.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

index cd0a23f432ff868ad0c598d599eac0508c91fbaa..36716541e505ec1712fabcdba959435d956f9b31 100644 (file)
@@ -783,6 +783,10 @@ int smu_v13_0_6_get_metrics_table(struct smu_context *smu, void *metrics_table,
                if (ret)
                        return ret;
 
+               if (!memchr_inv(smu_table->metrics_table, 0xff,
+                               min(16, table_size)))
+                       return -EHWPOISON;
+
                smu_table->metrics_time = jiffies;
        }