Skip to contentSkip to conversation

drm/edid: Fix parsing of EDID 1.4 Established Timings III descriptor

PATCH Applied Paul Parsons 3 participants 4 messages Mar 26, 2016 – Apr 5, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/edid: Fix parsing of EDID 1.4 Established Timings III descriptor

The EDID 1.4 specification section 3.10.3.9 defines an Established Timings III descriptor (tag #F7h). The parsing of this descriptor by drm_est3_modes() is off by one byte: the offset of the first timing bitmap is 6, not 5.

---

drivers/gpu/drm/drm_edid.c +1 -1
diff -ru a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
@@ -2215,7 +2215,7 @@
 {
 	int i, j, m, modes = 0;
 	struct drm_display_mode *mode;
-	u8 *est = ((u8 *)timing) + 5;
+	u8 *est = ((u8 *)timing) + 6;
 
 	for (i = 0; i < 6; i++) {
 		for (j = 7; j >= 0; j--) {

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Paul Parsons

The EDID 1.4 specification section 3.10.3.9 defines an Established Timings III descriptor (tag #F7h). The parsing of this descriptor by drm_est3_modes() is off by one byte: the offset of the first timing bitmap is 6, not 5.

I'm not all that familiar with the EDID parsing code, but this seems right.

I'd appreciate an extra set of eyeballs on this one still.

Makes you wonder about the implications though. We've been reading the revision number as a bitmask and otherwise been off by one byte. The interpretation of Established Timings III would have been pretty much random. Where are the bugs?

BR,
Jani.

Quoted 21 lines

---

diff -ru a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c

drivers/gpu/drm/drm_edid.c +1 -1
@@ -2215,7 +2215,7 @@
 {
 	int i, j, m, modes = 0;
 	struct drm_display_mode *mode;
-	u8 *est = ((u8 *)timing) + 5;
+	u8 *est = ((u8 *)timing) + 6;
 
 	for (i = 0; i < 6; i++) {
 		for (j = 7; j >= 0; j--) {

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#2 lore raw
In reply to Paul Parsons
Quoted 11 lines · Paul Parsons

The EDID 1.4 specification section 3.10.3.9 defines an Established Timings III descriptor (tag #F7h). The parsing of this descriptor by drm_est3_modes() is off by one byte: the offset of the first timing bitmap is 6, not 5.

---

diff -ru a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c

drivers/gpu/drm/drm_edid.c line 2218

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +1 -1
@@ -2215,7 +2215,7 @@
 {
 	int i, j, m, modes = 0;
 	struct drm_display_mode *mode;
-	u8 *est = ((u8 *)timing) + 5;
+	u8 *est = ((u8 *)timing) + 6;

Hmm. The code is very hard to follow due to the weird structs and whatnot. But yeah this looks correct.

Oh and I suppose you could also fix up the EDID version check to check for 1.4+ before even considering the est3 descriptor as valid.

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +0 -0
 	for (i = 0; i < 6; i++) {
 		for (j = 7; j >= 0; j--) {
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied
#3 lore raw
Quoted 21 lines · Ville Syrjälä
Quoted 11 lines · Paul Parsons

The EDID 1.4 specification section 3.10.3.9 defines an Established Timings III descriptor (tag #F7h). The parsing of this descriptor by drm_est3_modes() is off by one byte: the offset of the first timing bitmap is 6, not 5.

---

diff -ru a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c

drivers/gpu/drm/drm_edid.c line 2218

Quoted 5 lines
drivers/gpu/drm/drm_edid.c +1 -1
@@ -2215,7 +2215,7 @@
 {
 	int i, j, m, modes = 0;
 	struct drm_display_mode *mode;
-	u8 *est = ((u8 *)timing) + 5;
+	u8 *est = ((u8 *)timing) + 6;

Hmm. The code is very hard to follow due to the weird structs and whatnot. But yeah this looks correct.

Quoted 1 line

Pushed to our topic/drm-fixes, thanks for the patch and review.

BR,
Jani.

Quoted 15 lines

Oh and I suppose you could also fix up the EDID version check to check for 1.4+ before even considering the est3 descriptor as valid.

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +0 -0
 	for (i = 0; i < 6; i++) {
 		for (j = 7; j >= 0; j--) {
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel