NetworkManager/include
Beniamino Galvani 18770ece53 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
(cherry picked from commit bc9d034775)
2015-11-15 11:18:48 +01:00
..
gsystem-local-alloc.h libgsystem: update copy of gsystem-local-alloc.h 2015-03-20 12:53:26 +01:00
Makefile.am build: extract version macros from "nm-version.h" to new header file "nm-version-macros.h" 2015-09-30 23:35:52 +02:00
nm-dbus-glib-types.h core: fix new NMIP4Config and NMIP6Config properties 2014-11-07 11:09:35 -05:00
nm-glib-compat.h glib-compat: backport g_key_file_save_to_file() 2015-07-03 09:24:02 +02:00
nm-gvaluearray-compat.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-macros-internal.h macros: avoid signed overflow in nm_utils_is_power_of_two() 2015-11-15 11:18:48 +01:00
nm-test-utils.h test: add nmtst_platform_ip4_route() utils 2015-07-14 13:44:57 +02: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:35:52 +02:00