summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-03-09 15:50:20 +0100
committerThomas Haller <thaller@redhat.com>2017-03-09 15:50:20 +0100
commit74f62d21ce58301957b93424104cdc3bd1087419 (patch)
tree88b1ed3b5885d72ce1ffc9cca2159672fe727ed3
parentf0e295d3d746eb1350e0af263263e683a7bb7746 (diff)
downloadNetworkManager-74f62d21ce58301957b93424104cdc3bd1087419.tar.gz
platform/tests: add test code to initialize NMPCacheId with bogus data
-rw-r--r--src/platform/nmp-object.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/platform/nmp-object.c b/src/platform/nmp-object.c
index 97df90f532..a38a2eea87 100644
--- a/src/platform/nmp-object.c
+++ b/src/platform/nmp-object.c
@@ -1028,6 +1028,20 @@ _nmp_cache_id_init (NMPCacheId *id, NMPCacheIdType id_type)
* all structs have the packed attribute, there are no holes
* due to alignment, and it becomes simple for nmp_cache_id_init_*()
* to ensure that all fields are set. */
+
+#if NM_MORE_ASSERTS
+ nm_assert (id);
+ {
+ guint i;
+
+ /* initialized with some bogus canary to hopefully detect when we miss
+ * to initialize a field of the cache-id. */
+ for (i = 0; i < sizeof (*id); i++) {
+ ((char *) id)[i] = GPOINTER_TO_UINT (id) ^ i;
+ }
+ }
+#endif
+
id->_id_type = id_type;
}