drm/amd/display: Fix index out of bounds in DCN30 color transformation
authorjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:29:43 +0000 (02:29 +0000)
committerjsg <jsg@openbsd.org>
Fri, 11 Oct 2024 02:29:43 +0000 (02:29 +0000)
From Srinivasan Shanmugam
929506d5671419cffd8d01e9a7f5eae53682a838 in linux-6.6.y/6.6.55
d81873f9e715b72d4f8d391c8eb243946f784dfc in mainline linux

sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_cm_common.c

index e0b1fc9..62c02ad 100644 (file)
@@ -178,6 +178,8 @@ bool cm3_helper_translate_curve_to_hw_format(
                                i += increment) {
                        if (j == hw_points - 1)
                                break;
+                       if (i >= TRANSFER_FUNC_POINTS)
+                               return false;
                        rgb_resulted[j].red = output_tf->tf_pts.red[i];
                        rgb_resulted[j].green = output_tf->tf_pts.green[i];
                        rgb_resulted[j].blue = output_tf->tf_pts.blue[i];