[PATCH] stubdom: Fix GCC 14 -Wmemset-elt-size compiler warnings in PolarSSL

Andrew Mbugua <[email protected]>
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
When compiling Xen with GCC 14, I get a compiler warning originating from the /polarssl-x86_64/library about a memset element size mismatch:

ssl_tls.c: In function ‘ssl_session_reset’:
ssl_tls.c:1778:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
1778 |     memset( ssl->ctx_enc, 0, 128 );
|     ^~~~~~
ssl_tls.c:1779:5: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
1779 |     memset( ssl->ctx_dec, 0, 128 );
|     ^~~~~~

This patch introduces a build-time patch to PolarSSL that replaces the hardcoded 128 byte length with a dynamic sizeof(), thus allowing clean compilation without warnings.

Signed-off-by: Andrew Mbugua <[email protected]>
---
 stubdom/patches/polarssl-gcc14-memset.patch | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 stubdom/patches/polarssl-gcc14-memset.patch

diff --git a/stubdom/patches/polarssl-gcc14-memset.patch b/stubdom/patches/polarssl-gcc14-memset.patch
new file mode 100644
index 0000000000..d98664d0a8
--- /dev/null
+++ b/stubdom/patches/polarssl-gcc14-memset.patch
@@ -0,0 +1,13 @@
+--- a/library/ssl_tls.c
++++ b/library/ssl_tls.c
+@@ -1775,8 +1775,8 @@
+     memset( ssl->iv_dec, 0, 16 );
+     memset( ssl->mac_enc, 0, 32 );
+     memset( ssl->mac_dec, 0, 32 );
+-    memset( ssl->ctx_enc, 0, 128 );
+-    memset( ssl->ctx_dec, 0, 128 );
++    memset( ssl->ctx_enc, 0, sizeof( *ssl->ctx_enc) );
++    memset( ssl->ctx_dec, 0, sizeof( *ssl->ctx_dec) );
+ 
+      md5_starts( &ssl->fin_md5  );
+     sha1_starts( &ssl->fin_sha1 );
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.