[Pacemaker] [PATCH] Couldn't find src in NULL - missing null check

Grüninger, Andreas (LGL Extern) Andreas.Grueninger at lgl.bwl.de
Sat Oct 6 18:28:20 CEST 2012


I found this in the logfile:

....
Sep 29 19:14:29 [770]        cib:   notice: log_cib_diff:       cib:diff: Diff: --- 0.11.3
Sep 29 19:14:29 [770]        cib:   notice: log_cib_diff:       cib:diff: Diff: +++ 0.12.1
Sep 29 19:14:29 [776]       crmd:   notice: do_state_transition:        State transition S_IDLE -> S_POLICY_ENGINE [ input=I_PE_CALC cause=C_FSA_INTERNAL origin=abort_transition_graph ]
Sep 29 19:14:29 [770]        cib:   notice: cib:diff:   -- <cib admin_epoch="0" epoch="11" num_updates="3" />
Sep 29 19:14:29 [770]        cib:   notice: cib:diff:   ++         <meta_attributes id="ClusterMon_SNMPTraps-meta_attributes" >
Sep 29 19:14:29 [6626]    crm_mon:    error: crm_element_value:         Couldn't find src in NULL
Sep 29 19:14:29 [770]        cib:   notice: cib:diff:   ++           <nvpair id="ClusterMon_SNMPTraps-meta_attributes-target-role" name="target-role" value="Stopped" />
Sep 29 19:14:29 [770]        cib:   notice: cib:diff:   ++         </meta_attributes>
Sep 29 19:14:29 [770]        cib:     info: cib_process_request:        Operation complete: op cib_replace for section re
...

The error stems from the call of cib_process_diff in lib/cib/cib_ops.c.
Some calls of cib_process_diff with NULL for argument req:

./cib/cibmon.c:234:        rc = cib_process_diff(op, cib_force_diff, NULL, NULL, diff, cib_last, &cib_copy, NULL);
./cib/messages.c:261:    rc = cib_process_diff(op, options, section, req, input, existing_cib, result_cib, answer);
./lib/cib/cib_utils.c:755:        rc = cib_process_diff(NULL, cib_none, NULL, NULL, diff, input, output, NULL);
./lib/cib/cib_ops.c:544:cib_process_diff(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,
./lib/cib/cib_file.c:233:    {CIB_OP_APPLY_DIFF, FALSE, cib_process_diff},

This patch and another one is available in https://github.com/beekhof/pacemaker/pulls.

diff --git a/lib/cib/cib_ops.c b/lib/cib/cib_ops.c
index 66f0e20..e166f63 100644
--- a/lib/cib/cib_ops.c
+++ b/lib/cib/cib_ops.c
@@ -561,7 +561,10 @@ cib_process_diff(const char *op, int options, const char *section, xmlNode * req
     int diff_del_epoch = 0;
     int diff_del_admin_epoch = 0;

-    const char *originator = crm_element_value(req, F_ORIG);
+    char *originator = NULL;
+    if (req != NULL) {
+        originator = crm_element_value(req, F_ORIG);
+    }
     crm_trace("Processing \"%s\" event", op);

     cib_diff_version_details(input,

Andreas



More information about the Pacemaker mailing list