diff options
author | Quentin Schulz <quentin.schulz@theobroma-systems.com> | 2023-06-20 14:40:19 +0200 |
---|---|---|
committer | Quentin Schulz <quentin.schulz@theobroma-systems.com> | 2023-06-20 15:02:19 +0200 |
commit | 7e7324b0ca5b1353acdcddd65d12e2428ff4d889 (patch) | |
tree | f923396c33767e11eaed9594c742f40d30be796d | |
parent | e08e32143dd5d194f7d1a4633efc6d4279d30e89 (diff) |
TSD: common: edid: fix possible uninitialized variable use
In function ‘do_hdmi_vsdb_modes’,
inlined from ‘add_cea_modes’ at common/edid.c:3617:12,
inlined from ‘drm_add_edid_modes’ at common/edid.c:5542:15:
common/edid.c:2934:17: error: ‘hdmi_len’ may be used uninitialized [-Werror=maybe-uninitialized]
2934 | if (len < (8 + offset + 2))
| ~~~~^~~~~~~~~~~~~~~~~~
common/edid.c: In function ‘drm_add_edid_modes’:
common/edid.c:3582:17: note: ‘hdmi_len’ was declared here
3582 | u8 dbl, hdmi_len, video_len = 0;
| ^~~~~~~~
cc1: all warnings being treated as errors
Considering that hdmi_len stores the length of the CEA block payload,
that do_hdmi_vsdb_modes function is skipped if hdmi_len is less than 8
bytes long and that hdmi_len is only set when cea_db_is_hdmi_vsdb
function succeeds, setting hdmi_len to 0 seems a good way to fix this
error.
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
-rw-r--r-- | common/edid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/edid.c b/common/edid.c index d7d224cc58..b4c66bd373 100644 --- a/common/edid.c +++ b/common/edid.c @@ -3579,7 +3579,7 @@ int add_cea_modes(struct hdmi_edid_data *data, struct edid *edid) { const u8 *cea = drm_find_cea_extension(edid); const u8 *db, *hdmi = NULL, *video = NULL; - u8 dbl, hdmi_len, video_len = 0; + u8 dbl, hdmi_len = 0, video_len = 0; int modes = 0; if (cea && cea_revision(cea) >= 3) { |