NetworkManager/shared
Thomas Haller 040c86f15c
shared: avoid compiler warning for nm_utils_get_next_realloc_size() returning huge sizes
On s390x (gcc-8.3.1-5.1.el8.s390x) the compiler warns that we don't
pass size larger than 2^63-1 to malloc. With LTO enabled, it is also
quite adamant in detecting that with nm_utils_get_next_realloc_size().

Optimally, we would disable this useless warning with "-Wno-alloc-size-larger-than",
but that seems not to work. So add a workaround in code :(

It's hard to actually workaround the warning while handling all kinds of
sizes. The only simple solution is to no handle such huge cases and only
assert.

    In function 'nm_secret_mem_realloc',
        inlined from '_nm_str_buf_ensure_size' at shared/nm-glib-aux/nm-shared-utils.c:5316:31:
    shared/nm-glib-aux/nm-secret-utils.h:180:17: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
             m_new = g_malloc(new_len);
                     ^
    shared/nm-glib-aux/nm-secret-utils.h: In function '_nm_str_buf_ensure_size':
    /usr/include/glib-2.0/glib/gmem.h:78:10: note: in a call to allocation function 'g_malloc' declared here
     gpointer g_malloc         (gsize  n_bytes) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
              ^
    lto1: all warnings being treated as errors
2021-01-11 19:03:28 +01:00
..
c-list shared/c-list: reimport 2020-06-03 22:00:56 +02:00
c-rbtree shared/c-rbtree: reimport 2020-10-21 10:40:29 +02:00
c-siphash all: fix minor typos 2020-07-07 11:33:46 +02:00
c-stdaux all: fix minor typos 2020-07-07 11:33:46 +02:00
n-acd all: fix minor typos 2020-07-07 11:33:46 +02:00
n-dhcp4 n-dhcp4: revert "all: remove unnecessary <netinet/ether.h> includes" 2021-01-11 10:06:17 +01:00
nm-glib-aux shared: avoid compiler warning for nm_utils_get_next_realloc_size() returning huge sizes 2021-01-11 19:03:28 +01:00
nm-std-aux shared: avoid compiler warning for nm_utils_get_next_realloc_size() returning huge sizes 2021-01-11 19:03:28 +01:00
nm-udev-aux all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-utils all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
systemd all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
meson.build all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-default.h all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-meta-setting.c all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-meta-setting.h all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-test-libnm-utils.h all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-test-utils-impl.c all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00
nm-version-macros.h.in all: update deprecated SPDX license identifiers 2021-01-05 09:46:21 +01:00