From d4ab299aee5e4eb76c8fdd5b03813ade424e1413 Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 28 Nov 2022 08:07:58 -0500 Subject: [PATCH 1/3] Low: tests: s/xmllint_errfile/xmllint_outfile --- cts/cts-cli.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cts/cts-cli.in b/cts/cts-cli.in index 10e70ec16..421a95408 100755 --- a/cts/cts-cli.in +++ b/cts/cts-cli.in @@ -2525,7 +2525,7 @@ done rm -rf "${shadow_dir}" rm -f "${test_assert_outfile}" rm -f "${test_assert_errfile}" -rm -f "${xmllint_errfile}" +rm -f "${xmllint_outfile}" failed=0 -- 2.31.1 From 050afc17357190121aab692d04df01922dfe107f Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 28 Nov 2022 08:35:08 -0500 Subject: [PATCH 2/3] Low: daemons: Check for NULL in attrd_create_attribute. --- daemons/attrd/attrd_attributes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemons/attrd/attrd_attributes.c b/daemons/attrd/attrd_attributes.c index e08908d55..f1da16a93 100644 --- a/daemons/attrd/attrd_attributes.c +++ b/daemons/attrd/attrd_attributes.c @@ -29,6 +29,8 @@ attrd_create_attribute(xmlNode *xml) const char *value = crm_element_value(xml, PCMK__XA_ATTR_DAMPENING); attribute_t *a = calloc(1, sizeof(attribute_t)); + CRM_ASSERT(a != NULL); + a->id = crm_element_value_copy(xml, PCMK__XA_ATTR_NAME); a->set = crm_element_value_copy(xml, PCMK__XA_ATTR_SET); a->uuid = crm_element_value_copy(xml, PCMK__XA_ATTR_UUID); -- 2.31.1 From ff914815fe59f87473b45937c1152c1cc6f9e7bd Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Mon, 28 Nov 2022 08:35:27 -0500 Subject: [PATCH 3/3] Low: libs: Check for NULL in various functions. These were found by covscan and have been marked as false positives for a while, but I'm not sure that is totally the case. --- lib/pacemaker/pcmk_sched_migration.c | 7 +++++-- lib/pengine/pe_notif.c | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/pacemaker/pcmk_sched_migration.c b/lib/pacemaker/pcmk_sched_migration.c index 0e302d325..7e6ba8ef9 100644 --- a/lib/pacemaker/pcmk_sched_migration.c +++ b/lib/pacemaker/pcmk_sched_migration.c @@ -77,8 +77,11 @@ pcmk__create_migration_actions(pe_resource_t *rsc, const pe_node_t *current) if (rsc->partial_migration_target == NULL) { pe__set_action_flags(migrate_from, pe_action_migrate_runnable); - pe__set_action_flags(migrate_to, pe_action_migrate_runnable); - migrate_to->needs = start->needs; + + if (migrate_to != NULL) { + pe__set_action_flags(migrate_to, pe_action_migrate_runnable); + migrate_to->needs = start->needs; + } // Probe -> migrate_to -> migrate_from pcmk__new_ordering(rsc, pcmk__op_key(rsc->id, RSC_STATUS, 0), NULL, diff --git a/lib/pengine/pe_notif.c b/lib/pengine/pe_notif.c index 4427358e0..3d090f118 100644 --- a/lib/pengine/pe_notif.c +++ b/lib/pengine/pe_notif.c @@ -366,6 +366,8 @@ new_post_notify_action(pe_resource_t *rsc, pe_node_t *node, { pe_action_t *notify = NULL; + CRM_ASSERT(n_data != NULL); + // Create the "post-" notify action for specified instance notify = new_notify_action(rsc, node, n_data->post, n_data->post_done, n_data); @@ -534,6 +536,10 @@ collect_resource_data(pe_resource_t *rsc, bool activity, notify_data_t *n_data) notify_entry_t *entry = NULL; pe_node_t *node = NULL; + if (n_data == NULL) { + return; + } + if (n_data->allowed_nodes == NULL) { n_data->allowed_nodes = rsc->allowed_nodes; } @@ -975,9 +981,12 @@ pe__order_notifs_after_fencing(pe_action_t *stop, pe_resource_t *rsc, crm_info("Ordering notifications for implied %s after fencing", stop->uuid); n_data = pe__clone_notif_pseudo_ops(rsc, RSC_STOP, NULL, stonith_op); - collect_resource_data(rsc, false, n_data); - add_notify_env(n_data, "notify_stop_resource", rsc->id); - add_notify_env(n_data, "notify_stop_uname", stop->node->details->uname); - create_notify_actions(uber_parent(rsc), n_data); - pe__free_notification_data(n_data); + + if (n_data != NULL) { + collect_resource_data(rsc, false, n_data); + add_notify_env(n_data, "notify_stop_resource", rsc->id); + add_notify_env(n_data, "notify_stop_uname", stop->node->details->uname); + create_notify_actions(uber_parent(rsc), n_data); + pe__free_notification_data(n_data); + } } -- 2.31.1