[PATCH xf86-video-cirrus 2/3] Check for a successful transmission of EDID for Laguna I2C bus code
Kevin Brace
kevinbrace at gmx.com
Wed Apr 17 23:45:20 UTC 2019
The existing code can potentially cause a null pointer crash if EDID
was not obtained successfully.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
src/lg_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/lg_driver.c b/src/lg_driver.c
index be8963a..1042030 100644
--- a/src/lg_driver.c
+++ b/src/lg_driver.c
@@ -360,6 +360,12 @@ LgDoDDC(ScrnInfoPtr pScrn)
* Read and output monitor info using DDC2 over I2C bus.
*/
MonInfo = xf86DoEDID_DDC2(XF86_SCRN_ARG(pScrn), pCir->I2CPtr1);
+ if (!MonInfo) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Failed to obtain EDID.\n");
+ goto unmap_out;
+ }
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"I2C Monitor info: %p\n", (void *)MonInfo);
xf86PrintEDID(MonInfo);
--
2.17.1
More information about the xorg-devel
mailing list