All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] puzzles: Fix stringop-overflow warning
@ 2021-02-27 22:14 Khem Raj
  2021-02-27 22:14 ` [PATCH 2/2] igt-gpu-tools: Fix warnings with gcc 11 Khem Raj
  0 siblings, 1 reply; 2+ messages in thread
From: Khem Raj @ 2021-02-27 22:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

gcc11 is pedantic about it and finds a case where this
maybe used uninitialized

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...01-map-Fix-stringop-overflow-warning.patch | 42 +++++++++++++++++++
 meta/recipes-sato/puzzles/puzzles_git.bb      |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch

diff --git a/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch
new file mode 100644
index 0000000000..a02d8732ab
--- /dev/null
+++ b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch
@@ -0,0 +1,42 @@
+From 3d78d4cffcdc1242892b6c21c26d1c96938c48d1 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 27 Feb 2021 10:02:43 -0800
+Subject: [PATCH] map: Fix stringop-overflow warning
+
+Fixes
+
+../git/map.c: In function 'new_game_desc':
+../git/map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
+ 1663 |         ret[retlen++] = ',';
+      |         ~~~~~~~~~~~~~~^~~~~
+../git/./map.c: In function 'new_game_desc':
+../git/./map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
+ 1663 |         ret[retlen++] = ',';
+      |         ~~~~~~~~~~~~~~^~~~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ map.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/map.c b/map.c
+index 412305c..fa0c493 100644
+--- a/map.c
++++ b/map.c
+@@ -1659,8 +1659,10 @@ static char *new_game_desc(const game_params *params, random_state *rs,
+ 	    }
+ 	}
+ 
+-	ret[retlen++] = 'a'-1 + run;
+-	ret[retlen++] = ',';
++	if(ret != NULL) {
++		ret[retlen++] = 'a'-1 + run;
++		ret[retlen++] = ',';
++	}
+ 
+ 	run = 0;
+ 	for (i = 0; i < n; i++) {
+-- 
+2.30.1
+
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb
index 5b65cf8655..ecc2b9844d 100644
--- a/meta/recipes-sato/puzzles/puzzles_git.bb
+++ b/meta/recipes-sato/puzzles/puzzles_git.bb
@@ -15,6 +15,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \
            file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \
            file://fix-ki-uninitialized.patch \
            file://0001-malloc-Check-for-excessive-values-to-malloc.patch \
+           file://0001-map-Fix-stringop-overflow-warning.patch \
            "
 
 UPSTREAM_CHECK_COMMITS = "1"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] igt-gpu-tools: Fix warnings with gcc 11
  2021-02-27 22:14 [PATCH 1/2] puzzles: Fix stringop-overflow warning Khem Raj
@ 2021-02-27 22:14 ` Khem Raj
  0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2021-02-27 22:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...t_edid-Allocate-raw-8-bytes-for-VSDB.patch | 42 +++++++++++++++++++
 .../igt-gpu-tools/igt-gpu-tools_git.bb        |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/0001-lib-igt_edid-Allocate-raw-8-bytes-for-VSDB.patch

diff --git a/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/0001-lib-igt_edid-Allocate-raw-8-bytes-for-VSDB.patch b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/0001-lib-igt_edid-Allocate-raw-8-bytes-for-VSDB.patch
new file mode 100644
index 0000000000..38bd4550a3
--- /dev/null
+++ b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools/0001-lib-igt_edid-Allocate-raw-8-bytes-for-VSDB.patch
@@ -0,0 +1,42 @@
+From 606349860d27492c328752dca5a3784c0e9a6d24 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 27 Feb 2021 11:05:45 -0800
+Subject: [PATCH i-g-t] lib/igt_edid: Allocate raw 8-bytes for VSDB
+
+hdmi_vsdb is an element of cea_vsdb which makes the size of cea_vsdb to
+be 8 ( 3bytes ieee_oui ) + ( 5bytes hdmi_vsdb struct), its true that we
+only use 7 bytes technically we can only allocate 7byte array but since
+we are writing to elements of hdmi_vsdb struct which is sitting at offet
+4-8 in cea_vsdb, compiler thinks we have an element which is out of
+array bounds since out allocated size is 7bytes
+
+This errors out
+../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]
+  365 |         hdmi->src_phy_addr[0] = 0x10;
+      |             ^~
+
+allocating one extra byte matches with size of cea_vsdb and compiler is
+happy
+
+Upstream-Status: Submitted [https://lists.freedesktop.org/archives/igt-dev/2021-February/029446.html]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/igt_edid.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/igt_edid.c b/lib/igt_edid.c
+index 1c85486d..ce09cc47 100644
+--- a/lib/igt_edid.c
++++ b/lib/igt_edid.c
+@@ -351,7 +351,7 @@ void cea_sad_init_pcm(struct cea_sad *sad, int channels,
+ const struct cea_vsdb *cea_vsdb_get_hdmi_default(size_t *size)
+ {
+ 	/* We'll generate a VSDB with 2 extension fields. */
+-	static char raw[CEA_VSDB_HDMI_MIN_SIZE + 2] = {0};
++	static char raw[CEA_VSDB_HDMI_MIN_SIZE + 3] = {0};
+ 	struct cea_vsdb *vsdb;
+ 	struct hdmi_vsdb *hdmi;
+ 
+-- 
+2.30.1
+
diff --git a/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb
index f25cbc0603..098594cf2c 100644
--- a/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb
+++ b/meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb
@@ -11,6 +11,7 @@ SRCREV = "d16ad07e7f2a028e14d61f570931c87fa5ce404c"
 PV = "1.25+git${SRCPV}"
 
 SRC_URI = "git://gitlab.freedesktop.org/drm/igt-gpu-tools.git;protocol=https \
+           file://0001-lib-igt_edid-Allocate-raw-8-bytes-for-VSDB.patch \
            file://reproducibility.patch"
 
 S = "${WORKDIR}/git"
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-27 22:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27 22:14 [PATCH 1/2] puzzles: Fix stringop-overflow warning Khem Raj
2021-02-27 22:14 ` [PATCH 2/2] igt-gpu-tools: Fix warnings with gcc 11 Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.