]> code.ossystems Code Review - openembedded-core.git/blob
38bd4550a31df78a576794788e5ca313da1338e1
[openembedded-core.git] /
1 From 606349860d27492c328752dca5a3784c0e9a6d24 Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Sat, 27 Feb 2021 11:05:45 -0800
4 Subject: [PATCH i-g-t] lib/igt_edid: Allocate raw 8-bytes for VSDB
5
6 hdmi_vsdb is an element of cea_vsdb which makes the size of cea_vsdb to
7 be 8 ( 3bytes ieee_oui ) + ( 5bytes hdmi_vsdb struct), its true that we
8 only use 7 bytes technically we can only allocate 7byte array but since
9 we are writing to elements of hdmi_vsdb struct which is sitting at offet
10 4-8 in cea_vsdb, compiler thinks we have an element which is out of
11 array bounds since out allocated size is 7bytes
12
13 This errors out
14 ../git/lib/igt_edid.c:365:13: error: array subscript 'struct hdmi_vsdb[0]' is partly outside array bounds of 'char[7]' [-Werror=array-bounds]
15   365 |         hdmi->src_phy_addr[0] = 0x10;
16       |             ^~
17
18 allocating one extra byte matches with size of cea_vsdb and compiler is
19 happy
20
21 Upstream-Status: Submitted [https://lists.freedesktop.org/archives/igt-dev/2021-February/029446.html]
22 Signed-off-by: Khem Raj <raj.khem@gmail.com>
23 ---
24  lib/igt_edid.c | 2 +-
25  1 file changed, 1 insertion(+), 1 deletion(-)
26
27 diff --git a/lib/igt_edid.c b/lib/igt_edid.c
28 index 1c85486d..ce09cc47 100644
29 --- a/lib/igt_edid.c
30 +++ b/lib/igt_edid.c
31 @@ -351,7 +351,7 @@ void cea_sad_init_pcm(struct cea_sad *sad, int channels,
32  const struct cea_vsdb *cea_vsdb_get_hdmi_default(size_t *size)
33  {
34         /* We'll generate a VSDB with 2 extension fields. */
35 -       static char raw[CEA_VSDB_HDMI_MIN_SIZE + 2] = {0};
36 +       static char raw[CEA_VSDB_HDMI_MIN_SIZE + 3] = {0};
37         struct cea_vsdb *vsdb;
38         struct hdmi_vsdb *hdmi;
39  
40 -- 
41 2.30.1
42