NetworkManager/include
Beniamino Galvani bc9d034775 macros: avoid signed overflow in nm_utils_is_power_of_two()
If __x is signed and its value is the minimum allowed for the type,
(__x - 1) causes a signed overflow, which has an undefined
behavior. Compiling with -fsanitize=undefined produces the warnings:

test-general.c:4499:619: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
test-general.c:4506:681: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'TEST_IS_POWER_OF_TWP_ENUM_SIGNED'
test-general.c:4501:619: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'long int'
test-general.c:4509:691: runtime error: signed integer overflow: -9223372036854775808 - 1 cannot be represented in type 'TEST_IS_POWER_OF_TWP_ENUM_UNSIGNED_64'

Change the order of expressions to avoid this.

Fixes: 0a3c1f5774
2015-11-15 11:13:29 +01:00
..
gsystem-local-alloc.h libgsystem: update copy of gsystem-local-alloc.h 2015-03-12 18:09:29 +01:00
Makefile.am build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h" 2015-09-30 23:10:29 +02:00
nm-dbus-compat.h include: add nm-dbus-compat.h 2015-07-24 13:25:47 -04:00
nm-default.h systemd/build: use separate NETWORKMANAGER_COMPILATION define for systemd build 2015-09-16 16:54:51 +02:00
nm-glib.h glib-compat: add g_hash_table_get_keys_as_array() compat function 2015-10-01 09:05:08 +02:00
nm-macros-internal.h macros: avoid signed overflow in nm_utils_is_power_of_two() 2015-11-15 11:13:29 +01:00
nm-test-utils.h tests: fix error message in nmtst_assert_ip6_address() 2015-11-02 18:19:05 +01:00
nm-version-macros.h.in build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h" 2015-09-30 23:10:29 +02:00