File gcc10-fixes.patch of Package xen.15648
References: bsc#1158414
For libxlu_pci.c
libxlu_pci.c: In function 'xlu_pci_parse_bdf':
libxlu_pci.c:32:18: error: 'func' may be used uninitialized in this function [-Werror=maybe-uninitialized]
32 | pcidev->func = func;
| ~~~~~~~~~~~~~^~~~~~
libxlu_pci.c:51:29: note: 'func' was declared here
51 | unsigned dom, bus, dev, func, vslot = 0;
| ^~~~
libxlu_pci.c:31:17: error: 'dev' may be used uninitialized in this function [-Werror=maybe-uninitialized]
31 | pcidev->dev = dev;
| ~~~~~~~~~~~~^~~~~
libxlu_pci.c:51:24: note: 'dev' was declared here
51 | unsigned dom, bus, dev, func, vslot = 0;
| ^~~
libxlu_pci.c:30:17: error: 'bus' may be used uninitialized in this function [-Werror=maybe-uninitialized]
30 | pcidev->bus = bus;
| ~~~~~~~~~~~~^~~~~
libxlu_pci.c:51:19: note: 'bus' was declared here
51 | unsigned dom, bus, dev, func, vslot = 0;
| ^~~
libxlu_pci.c:29:20: error: 'dom' may be used uninitialized in this function [-Werror=maybe-uninitialized]
29 | pcidev->domain = domain;
| ~~~~~~~~~~~~~~~^~~~~~~~
libxlu_pci.c:51:14: note: 'dom' was declared here
51 | unsigned dom, bus, dev, func, vslot = 0;
| ^~~
For kdd.c
kdd.c: In function 'kdd_tx':
kdd.c:408:30: error: array subscript 65534 is outside the bounds of an interior zero-length array 'uint8_t[0]' {aka 'unsigned char[0]'} [-Werror=zero-length-bounds]
408 | sum += s->txp.payload[i];
| ~~~~~~~~~~~~~~^~~
In file included from kdd.c:52:
kdd.h:326:17: note: while referencing 'payload'
326 | uint8_t payload[0];
| ^~~~~~~
cc1: all warnings being treated as errors
For ssl_tls.c
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 );
| ^~~~~~
ssl_tls.c: In function 'ssl_encrypt_buf':
ssl_tls.c:633:68: warning: this statement may fall through [-Wimplicit-fallthrough=]
633 | ssl->session->ciphersuite == SSL_RSA_CAMELLIA_256_SHA ||
ssl_tls.c:643:13: note: here
643 | default:
| ^~~~~~~
ssl_tls.c: In function 'ssl_decrypt_buf':
ssl_tls.c:738:68: warning: this statement may fall through [-Wimplicit-fallthrough=]
738 | ssl->session->ciphersuite == SSL_RSA_CAMELLIA_256_SHA ||
ssl_tls.c:748:13: note: here
748 | default:
| ^~~~~~~
For xenstored_core.h
ld: /home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/xenstored.a(xenstored_watch.o):/home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/xenstored_core.h:207: multiple definition of `xgt_handle'; /home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/xenstored.a(xenstored_core.o):/home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/xenstored_core.h:207: first defined here
For utils.h
ld: /home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/xenstored.a(xenstored_watch.o):/home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/utils.h:27: multiple definition of `xprintf'; /home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/xenstored.a(xenstored_core.o):/home/abuild/rpmbuild/BUILD/xen-4.13.0-testing/stubdom/xenstore/utils.h:27: first defined here
for libxl_utils.h
specified bound 108 equals destination size [-Werror=stringop-truncation]
xenpmd.c: In function 'get_next_battery_file':
xenpmd.c:92:37: error: '%s' directive output may be truncated writing between 4 and 2147483645 bytes into a region of size 271 [-Werror=format-truncation=]
92 | #define BATTERY_STATE_FILE_PATH "/tmp/battery/%s/state"
| ^~~~~~~~~~~~~~~~~~~~~~~
xenpmd.c:117:52: note: in expansion of macro 'BATTERY_STATE_FILE_PATH'
117 | snprintf(file_name, sizeof(file_name), BATTERY_STATE_FILE_PATH,
| ^~~~~~~~~~~~~~~~~~~~~~~
Index: xen-4.13.0-testing/tools/libxl/libxlu_pci.c
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxlu_pci.c
+++ xen-4.13.0-testing/tools/libxl/libxlu_pci.c
@@ -22,6 +22,9 @@ static int hex_convert(const char *str,
return 0;
}
+#if __GNUC__ >= 10
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
static int pcidev_struct_fill(libxl_device_pci *pcidev, unsigned int domain,
unsigned int bus, unsigned int dev,
unsigned int func, unsigned int vdevfn)
Index: xen-4.13.0-testing/tools/debugger/kdd/kdd.c
===================================================================
--- xen-4.13.0-testing.orig/tools/debugger/kdd/kdd.c
+++ xen-4.13.0-testing/tools/debugger/kdd/kdd.c
@@ -396,6 +396,9 @@ static void find_os(kdd_state *s)
*/
+#if __GNUC__ >= 10
+#pragma GCC diagnostic ignored "-Wzero-length-bounds"
+#endif
/* Send a serial packet */
static void kdd_tx(kdd_state *s)
{
Index: xen-4.13.0-testing/stubdom/polarssl.patch
===================================================================
--- xen-4.13.0-testing.orig/stubdom/polarssl.patch
+++ xen-4.13.0-testing/stubdom/polarssl.patch
@@ -62,3 +62,25 @@ diff -Naur polarssl-1.1.4/library/bignum
t_udbl r;
r = (t_udbl) X.p[i] << biL;
+--- polarssl-1.1.4/library/ssl_tls.c.orig 2012-05-30 01:39:36.000000000 -0600
++++ polarssl-1.1.4/library/ssl_tls.c 2020-03-10 10:17:26.270755351 -0600
+@@ -487,6 +487,9 @@ static void ssl_mac_sha1( unsigned char
+ sha1_finish( &sha1, buf + len );
+ }
+
++#if __GNUC__ >= 10
++#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
++#endif
+ /*
+ * Encryption/decryption functions
+ */
+@@ -1739,6 +1742,9 @@ int ssl_init( ssl_context *ssl )
+ return( 0 );
+ }
+
++#if __GNUC__ >= 10
++#pragma GCC diagnostic ignored "-Wmemset-elt-size"
++#endif
+ /*
+ * Reset an initialized and used SSL context for re-use while retaining
+ * all application-set variables, function pointers and data.
Index: xen-4.13.0-testing/tools/xenstore/xenstored_core.h
===================================================================
--- xen-4.13.0-testing.orig/tools/xenstore/xenstored_core.h
+++ xen-4.13.0-testing/tools/xenstore/xenstored_core.h
@@ -204,7 +204,11 @@ void finish_daemonize(void);
/* Open a pipe for signal handling */
void init_pipe(int reopen_log_pipe[2]);
+#if __GNUC__ >= 10
+extern xengnttab_handle **xgt_handle;
+#else
xengnttab_handle **xgt_handle;
+#endif
int remember_string(struct hashtable *hash, const char *str);
Index: xen-4.13.0-testing/tools/xenstore/utils.h
===================================================================
--- xen-4.13.0-testing.orig/tools/xenstore/utils.h
+++ xen-4.13.0-testing/tools/xenstore/utils.h
@@ -24,7 +24,11 @@ static inline bool strends(const char *a
void barf(const char *fmt, ...) __attribute__((noreturn));
void barf_perror(const char *fmt, ...) __attribute__((noreturn));
+#if __GNUC__ >= 10
+extern void (*xprintf)(const char *fmt, ...);
+#else
void (*xprintf)(const char *fmt, ...);
+#endif
#define eprintf(_fmt, _args...) xprintf("[ERR] %s" _fmt, __FUNCTION__, ##_args)
Index: xen-4.13.0-testing/tools/libxl/libxl_utils.c
===================================================================
--- xen-4.13.0-testing.orig/tools/libxl/libxl_utils.c
+++ xen-4.13.0-testing/tools/libxl/libxl_utils.c
@@ -1248,6 +1248,9 @@ int libxl__random_bytes(libxl__gc *gc, u
return ret;
}
+#if __GNUC__ >= 10
+#pragma GCC diagnostic ignored "-Wstringop-truncation"
+#endif
int libxl__prepare_sockaddr_un(libxl__gc *gc,
struct sockaddr_un *un, const char *path,
const char *what)
Index: xen-4.13.0-testing/tools/xenpmd/xenpmd.c
===================================================================
--- xen-4.13.0-testing.orig/tools/xenpmd/xenpmd.c
+++ xen-4.13.0-testing/tools/xenpmd/xenpmd.c
@@ -86,6 +86,9 @@ struct battery_status {
static struct xs_handle *xs;
+#if __GNUC__ >= 10
+#pragma GCC diagnostic ignored "-Wformat-truncation"
+#endif
#ifdef RUN_IN_SIMULATE_MODE
#define BATTERY_DIR_PATH "/tmp/battery"
#define BATTERY_INFO_FILE_PATH "/tmp/battery/%s/info"