Skip to content
This repository was archived by the owner on Jul 3, 2018. It is now read-only.

Commit b64d3a8

Browse files
Ashish GargGerrit - the friendly Code Review server
authored andcommitted
msm: mdss: validate page id before reading from edid buffer
Provide complete resolution details in a sysfs node "res_info" limited to PAGE_SIZE. Different modules can query for multiple resolution details based on the resolution ids received from EDID of the TV. In case resolution details exceed PAGE_SIZE, reuse res_info to get remaining timing details by provide page details. Check page id is within the max supported resolution ids to avoid reading extra memory than required. Change-Id: I7cdd071ba462080fe5bb302d0da824ed95b50f15 Signed-off-by: Ashish Garg <[email protected]>
1 parent f2a4824 commit b64d3a8

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

drivers/video/msm/mdss/mdss_hdmi_edid.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
1+
/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
22
*
33
* This program is free software; you can redistribute it and/or modify
44
* it under the terms of the GNU General Public License version 2 and
@@ -310,8 +310,10 @@ static ssize_t hdmi_edid_sysfs_wta_res_info(struct device *dev,
310310
struct device_attribute *attr, const char *buf, size_t count)
311311
{
312312
int rc, page_id;
313+
u32 i = 0, j, page;
313314
ssize_t ret = strnlen(buf, PAGE_SIZE);
314315
struct hdmi_edid_ctrl *edid_ctrl = hdmi_edid_get_ctrl(dev);
316+
struct msm_hdmi_mode_timing_info info = {0};
315317

316318
if (!edid_ctrl) {
317319
DEV_ERR("%s: invalid input\n", __func__);
@@ -324,7 +326,22 @@ static ssize_t hdmi_edid_sysfs_wta_res_info(struct device *dev,
324326
return rc;
325327
}
326328

327-
edid_ctrl->page_id = page_id;
329+
if (page_id > MSM_HDMI_INIT_RES_PAGE) {
330+
page = MSM_HDMI_INIT_RES_PAGE;
331+
while (page < page_id) {
332+
j = 1;
333+
while (sizeof(info) * j < PAGE_SIZE) {
334+
i++;
335+
j++;
336+
}
337+
page++;
338+
}
339+
}
340+
341+
if (i < HDMI_VFRMT_MAX)
342+
edid_ctrl->page_id = page_id;
343+
else
344+
DEV_ERR("%s: invalid page id\n", __func__);
328345

329346
DEV_DBG("%s: %d\n", __func__, edid_ctrl->page_id);
330347
return ret;

0 commit comments

Comments
 (0)