Bug Summary

File:build-scan/../src/libsystemd/sd-bus/test-bus-benchmark.c
Warning:line 309, column 9
Potential leak of memory pointed to by 'server_name'

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test-bus-benchmark.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=all -relaxed-aliasing -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fdenormal-fp-math=preserve-sign,preserve-sign -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/12.0.0 -include config.h -I test-bus-benchmark.p -I . -I .. -I src/basic -I ../src/basic -I src/shared -I ../src/shared -I src/systemd -I ../src/systemd -I src/journal -I ../src/journal -I src/journal-remote -I ../src/journal-remote -I src/nspawn -I ../src/nspawn -I src/resolve -I ../src/resolve -I src/timesync -I ../src/timesync -I ../src/time-wait-sync -I src/login -I ../src/login -I src/udev -I ../src/udev -I src/libudev -I ../src/libudev -I src/core -I ../src/core -I ../src/libsystemd/sd-bus -I ../src/libsystemd/sd-device -I ../src/libsystemd/sd-hwdb -I ../src/libsystemd/sd-id128 -I ../src/libsystemd/sd-netlink -I ../src/libsystemd/sd-network -I src/libsystemd-network -I ../src/libsystemd-network -D _FILE_OFFSET_BITS=64 -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/12.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wwrite-strings -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unused-result -Wno-format-signedness -Wno-error=nonnull -std=gnu99 -fconst-strings -fdebug-compilation-dir /home/mrc0mmand/repos/@redhat-plumbers/systemd-rhel8/build-scan -ferror-limit 19 -fvisibility hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcolor-diagnostics -analyzer-output=html -faddrsig -o /tmp/scan-build-2021-07-16-221226-1465241-1 -x c ../src/libsystemd/sd-bus/test-bus-benchmark.c
1/* SPDX-License-Identifier: LGPL-2.1+ */
2/***
3***/
4
5#include <sys/wait.h>
6
7#include "sd-bus.h"
8
9#include "alloc-util.h"
10#include "bus-internal.h"
11#include "bus-kernel.h"
12#include "bus-util.h"
13#include "def.h"
14#include "fd-util.h"
15#include "time-util.h"
16#include "util.h"
17
18#define MAX_SIZE(2*1024*1024) (2*1024*1024)
19
20static usec_t arg_loop_usec = 100 * USEC_PER_MSEC((usec_t) 1000ULL);
21
22typedef enum Type {
23 TYPE_LEGACY,
24 TYPE_DIRECT,
25} Type;
26
27static void server(sd_bus *b, size_t *result) {
28 int r;
29
30 for (;;) {
31 _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *m = NULL((void*)0);
32
33 r = sd_bus_process(b, &m);
34 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 34, __PRETTY_FUNCTION__); } while (0)
;
35
36 if (r == 0)
37 assert_se(sd_bus_wait(b, USEC_INFINITY) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_wait(b, ((usec_t) -1))
>= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("sd_bus_wait(b, USEC_INFINITY) >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 37, __PRETTY_FUNCTION__
); } while (0)
;
38 if (!m)
39 continue;
40
41 if (sd_bus_message_is_method_call(m, "benchmark.server", "Ping"))
42 assert_se(sd_bus_reply_method_return(m, NULL) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_reply_method_return(m,
((void*)0)) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("sd_bus_reply_method_return(m, NULL) >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 42, __PRETTY_FUNCTION__); } while (0)
;
43 else if (sd_bus_message_is_method_call(m, "benchmark.server", "Work")) {
44 const void *p;
45 size_t sz;
46
47 /* Make sure the mmap is mapped */
48 assert_se(sd_bus_message_read_array(m, 'y', &p, &sz) > 0)do { if ((__builtin_expect(!!(!(sd_bus_message_read_array(m, 'y'
, &p, &sz) > 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("sd_bus_message_read_array(m, 'y', &p, &sz) > 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 48, __PRETTY_FUNCTION__
); } while (0)
;
49
50 r = sd_bus_reply_method_return(m, NULL((void*)0));
51 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 51, __PRETTY_FUNCTION__); } while (0)
;
52 } else if (sd_bus_message_is_method_call(m, "benchmark.server", "Exit")) {
53 uint64_t res;
54 assert_se(sd_bus_message_read(m, "t", &res) > 0)do { if ((__builtin_expect(!!(!(sd_bus_message_read(m, "t", &
res) > 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD,
("sd_bus_message_read(m, \"t\", &res) > 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 54, __PRETTY_FUNCTION__); } while (0)
;
55
56 *result = res;
57 return;
58
59 } else if (!sd_bus_message_is_signal(m, NULL((void*)0), NULL((void*)0)))
60 assert_not_reached("Unknown method")do { log_assert_failed_unreachable_realm(LOG_REALM_SYSTEMD, (
"Unknown method"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 60, __PRETTY_FUNCTION__); } while (0)
;
61 }
62}
63
64static void transaction(sd_bus *b, size_t sz, const char *server_name) {
65 _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *m = NULL((void*)0), *reply = NULL((void*)0);
66 uint8_t *p;
67
68 assert_se(sd_bus_message_new_method_call(b, &m, server_name, "/", "benchmark.server", "Work") >= 0)do { if ((__builtin_expect(!!(!(sd_bus_message_new_method_call
(b, &m, server_name, "/", "benchmark.server", "Work") >=
0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("sd_bus_message_new_method_call(b, &m, server_name, \"/\", \"benchmark.server\", \"Work\") >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 68, __PRETTY_FUNCTION__
); } while (0)
;
69 assert_se(sd_bus_message_append_array_space(m, 'y', sz, (void**) &p) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_message_append_array_space
(m, 'y', sz, (void**) &p) >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("sd_bus_message_append_array_space(m, 'y', sz, (void**) &p) >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 69, __PRETTY_FUNCTION__
); } while (0)
;
70
71 memset(p, 0x80, sz);
72
73 assert_se(sd_bus_call(b, m, 0, NULL, &reply) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_call(b, m, 0, ((void*)
0), &reply) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("sd_bus_call(b, m, 0, NULL, &reply) >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 73, __PRETTY_FUNCTION__); } while (0)
;
74}
75
76static void client_bisect(const char *address, const char *server_name) {
77 _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *x = NULL((void*)0);
78 size_t lsize, rsize, csize;
79 sd_bus *b;
80 int r;
81
82 r = sd_bus_new(&b);
83 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 83, __PRETTY_FUNCTION__); } while (0)
;
84
85 r = sd_bus_set_address(b, address);
86 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 86, __PRETTY_FUNCTION__); } while (0)
;
87
88 r = sd_bus_start(b);
89 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 89, __PRETTY_FUNCTION__); } while (0)
;
90
91 r = sd_bus_call_method(b, server_name, "/", "benchmark.server", "Ping", NULL((void*)0), NULL((void*)0), NULL((void*)0));
92 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 92, __PRETTY_FUNCTION__); } while (0)
;
93
94 lsize = 1;
95 rsize = MAX_SIZE(2*1024*1024);
96
97 printf("SIZE\tCOPY\tMEMFD\n");
98
99 for (;;) {
100 usec_t t;
101 unsigned n_copying, n_memfd;
102
103 csize = (lsize + rsize) / 2;
104
105 if (csize <= lsize)
106 break;
107
108 if (csize <= 0)
109 break;
110
111 printf("%zu\t", csize);
112
113 b->use_memfd = 0;
114
115 t = now(CLOCK_MONOTONIC1);
116 for (n_copying = 0;; n_copying++) {
117 transaction(b, csize, server_name);
118 if (now(CLOCK_MONOTONIC1) >= t + arg_loop_usec)
119 break;
120 }
121 printf("%u\t", (unsigned) ((n_copying * USEC_PER_SEC((usec_t) 1000000ULL)) / arg_loop_usec));
122
123 b->use_memfd = -1;
124
125 t = now(CLOCK_MONOTONIC1);
126 for (n_memfd = 0;; n_memfd++) {
127 transaction(b, csize, server_name);
128 if (now(CLOCK_MONOTONIC1) >= t + arg_loop_usec)
129 break;
130 }
131 printf("%u\n", (unsigned) ((n_memfd * USEC_PER_SEC((usec_t) 1000000ULL)) / arg_loop_usec));
132
133 if (n_copying == n_memfd)
134 break;
135
136 if (n_copying > n_memfd)
137 lsize = csize;
138 else
139 rsize = csize;
140 }
141
142 b->use_memfd = 1;
143 assert_se(sd_bus_message_new_method_call(b, &x, server_name, "/", "benchmark.server", "Exit") >= 0)do { if ((__builtin_expect(!!(!(sd_bus_message_new_method_call
(b, &x, server_name, "/", "benchmark.server", "Exit") >=
0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("sd_bus_message_new_method_call(b, &x, server_name, \"/\", \"benchmark.server\", \"Exit\") >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 143, __PRETTY_FUNCTION__
); } while (0)
;
144 assert_se(sd_bus_message_append(x, "t", csize) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_message_append(x, "t",
csize) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("sd_bus_message_append(x, \"t\", csize) >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 144, __PRETTY_FUNCTION__); } while (0)
;
145 assert_se(sd_bus_send(b, x, NULL) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_send(b, x, ((void*)0))
>= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("sd_bus_send(b, x, NULL) >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 145, __PRETTY_FUNCTION__
); } while (0)
;
146
147 sd_bus_unref(b);
148}
149
150static void client_chart(Type type, const char *address, const char *server_name, int fd) {
151 _cleanup_(sd_bus_message_unrefp)__attribute__((cleanup(sd_bus_message_unrefp))) sd_bus_message *x = NULL((void*)0);
152 size_t csize;
153 sd_bus *b;
154 int r;
155
156 r = sd_bus_new(&b);
157 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 157, __PRETTY_FUNCTION__); } while (0)
;
158
159 if (type == TYPE_DIRECT) {
160 r = sd_bus_set_fd(b, fd, fd);
161 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 161, __PRETTY_FUNCTION__); } while (0)
;
162 } else {
163 r = sd_bus_set_address(b, address);
164 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 164, __PRETTY_FUNCTION__); } while (0)
;
165
166 r = sd_bus_set_bus_client(b, true1);
167 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 167, __PRETTY_FUNCTION__); } while (0)
;
168 }
169
170 r = sd_bus_start(b);
171 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 171, __PRETTY_FUNCTION__); } while (0)
;
172
173 r = sd_bus_call_method(b, server_name, "/", "benchmark.server", "Ping", NULL((void*)0), NULL((void*)0), NULL((void*)0));
174 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 174, __PRETTY_FUNCTION__); } while (0)
;
175
176 switch (type) {
177 case TYPE_LEGACY:
178 printf("SIZE\tLEGACY\n");
179 break;
180 case TYPE_DIRECT:
181 printf("SIZE\tDIRECT\n");
182 break;
183 }
184
185 for (csize = 1; csize <= MAX_SIZE(2*1024*1024); csize *= 2) {
186 usec_t t;
187 unsigned n_memfd;
188
189 printf("%zu\t", csize);
190
191 t = now(CLOCK_MONOTONIC1);
192 for (n_memfd = 0;; n_memfd++) {
193 transaction(b, csize, server_name);
194 if (now(CLOCK_MONOTONIC1) >= t + arg_loop_usec)
195 break;
196 }
197
198 printf("%u\n", (unsigned) ((n_memfd * USEC_PER_SEC((usec_t) 1000000ULL)) / arg_loop_usec));
199 }
200
201 b->use_memfd = 1;
202 assert_se(sd_bus_message_new_method_call(b, &x, server_name, "/", "benchmark.server", "Exit") >= 0)do { if ((__builtin_expect(!!(!(sd_bus_message_new_method_call
(b, &x, server_name, "/", "benchmark.server", "Exit") >=
0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("sd_bus_message_new_method_call(b, &x, server_name, \"/\", \"benchmark.server\", \"Exit\") >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 202, __PRETTY_FUNCTION__
); } while (0)
;
203 assert_se(sd_bus_message_append(x, "t", csize) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_message_append(x, "t",
csize) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("sd_bus_message_append(x, \"t\", csize) >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 203, __PRETTY_FUNCTION__); } while (0)
;
204 assert_se(sd_bus_send(b, x, NULL) >= 0)do { if ((__builtin_expect(!!(!(sd_bus_send(b, x, ((void*)0))
>= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("sd_bus_send(b, x, NULL) >= 0"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 204, __PRETTY_FUNCTION__
); } while (0)
;
205
206 sd_bus_unref(b);
207}
208
209int main(int argc, char *argv[]) {
210 enum {
211 MODE_BISECT,
212 MODE_CHART,
213 } mode = MODE_BISECT;
214 Type type = TYPE_LEGACY;
215 int i, pair[2] = { -1, -1 };
216 _cleanup_free___attribute__((cleanup(freep))) char *address = NULL((void*)0), *server_name = NULL((void*)0);
217 _cleanup_close___attribute__((cleanup(closep))) int bus_ref = -1;
218 const char *unique;
219 cpu_set_t cpuset;
220 size_t result;
221 sd_bus *b;
222 pid_t pid;
223 int r;
224
225 for (i = 1; i < argc; i++) {
1
Assuming 'i' is >= 'argc'
2
Loop condition is false. Execution continues on line 240
226 if (streq(argv[i], "chart")(strcmp((argv[i]),("chart")) == 0)) {
227 mode = MODE_CHART;
228 continue;
229 } else if (streq(argv[i], "legacy")(strcmp((argv[i]),("legacy")) == 0)) {
230 type = TYPE_LEGACY;
231 continue;
232 } else if (streq(argv[i], "direct")(strcmp((argv[i]),("direct")) == 0)) {
233 type = TYPE_DIRECT;
234 continue;
235 }
236
237 assert_se(parse_sec(argv[i], &arg_loop_usec) >= 0)do { if ((__builtin_expect(!!(!(parse_sec(argv[i], &arg_loop_usec
) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, (
"parse_sec(argv[i], &arg_loop_usec) >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 237, __PRETTY_FUNCTION__); } while (0)
;
238 }
239
240 assert_se(arg_loop_usec > 0)do { if ((__builtin_expect(!!(!(arg_loop_usec > 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("arg_loop_usec > 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 240, __PRETTY_FUNCTION__); } while (0)
;
3
Taking false branch
4
Loop condition is false. Exiting loop
241
242 if (type
4.1
'type' is equal to TYPE_LEGACY
== TYPE_LEGACY) {
5
Taking true branch
243 const char *e;
244
245 e = secure_getenv("DBUS_SESSION_BUS_ADDRESS");
246 assert_se(e)do { if ((__builtin_expect(!!(!(e)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("e"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 246, __PRETTY_FUNCTION__); } while (0)
;
6
Assuming 'e' is non-null
7
Taking false branch
8
Loop condition is false. Exiting loop
247
248 address = strdup(e);
249 assert_se(address)do { if ((__builtin_expect(!!(!(address)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("address"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 249, __PRETTY_FUNCTION__); } while (0)
;
9
Assuming 'address' is non-null
10
Taking false branch
11
Loop condition is false. Exiting loop
250 }
251
252 r = sd_bus_new(&b);
253 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 253, __PRETTY_FUNCTION__); } while (0)
;
12
Assuming 'r' is >= 0
13
Taking false branch
14
Loop condition is false. Exiting loop
254
255 if (type
14.1
'type' is not equal to TYPE_DIRECT
== TYPE_DIRECT) {
15
Taking false branch
256 assert_se(socketpair(AF_UNIX, SOCK_STREAM, 0, pair) >= 0)do { if ((__builtin_expect(!!(!(socketpair(1, SOCK_STREAM, 0,
pair) >= 0)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD
, ("socketpair(AF_UNIX, SOCK_STREAM, 0, pair) >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 256, __PRETTY_FUNCTION__); } while (0)
;
257
258 r = sd_bus_set_fd(b, pair[0], pair[0]);
259 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 259, __PRETTY_FUNCTION__); } while (0)
;
260
261 r = sd_bus_set_server(b, true1, SD_ID128_NULL((const sd_id128_t) { .qwords = { 0, 0 }}));
262 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 262, __PRETTY_FUNCTION__); } while (0)
;
263 } else {
264 r = sd_bus_set_address(b, address);
265 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 265, __PRETTY_FUNCTION__); } while (0)
;
16
Assuming 'r' is >= 0
17
Taking false branch
18
Loop condition is false. Exiting loop
266
267 r = sd_bus_set_bus_client(b, true1);
268 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 268, __PRETTY_FUNCTION__); } while (0)
;
19
Assuming 'r' is >= 0
20
Taking false branch
21
Loop condition is false. Exiting loop
269 }
270
271 r = sd_bus_start(b);
272 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 272, __PRETTY_FUNCTION__); } while (0)
;
22
Assuming 'r' is >= 0
23
Taking false branch
24
Loop condition is false. Exiting loop
273
274 if (type
24.1
'type' is not equal to TYPE_DIRECT
!= TYPE_DIRECT) {
25
Taking true branch
275 r = sd_bus_get_unique_name(b, &unique);
276 assert_se(r >= 0)do { if ((__builtin_expect(!!(!(r >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("r >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 276, __PRETTY_FUNCTION__); } while (0)
;
26
Assuming 'r' is >= 0
27
Taking false branch
28
Loop condition is false. Exiting loop
277
278 server_name = strdup(unique);
29
Memory is allocated
279 assert_se(server_name)do { if ((__builtin_expect(!!(!(server_name)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("server_name"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 279, __PRETTY_FUNCTION__); } while (0)
;
30
Assuming 'server_name' is non-null
31
Taking false branch
32
Loop condition is false. Exiting loop
280 }
281
282 sync();
283 setpriority(PRIO_PROCESSPRIO_PROCESS, 0, -19);
284
285 pid = fork();
286 assert_se(pid >= 0)do { if ((__builtin_expect(!!(!(pid >= 0)),0))) log_assert_failed_realm
(LOG_REALM_SYSTEMD, ("pid >= 0"), "../src/libsystemd/sd-bus/test-bus-benchmark.c"
, 286, __PRETTY_FUNCTION__); } while (0)
;
33
Assuming 'pid' is >= 0
34
Taking false branch
35
Loop condition is false. Exiting loop
287
288 if (pid == 0) {
36
Assuming 'pid' is not equal to 0
37
Taking false branch
289 CPU_ZERO(&cpuset)do __builtin_memset (&cpuset, '\0', sizeof (cpu_set_t)); while
(0)
;
290 CPU_SET(0, &cpuset)(__extension__ ({ size_t __cpu = (0); __cpu / 8 < (sizeof (
cpu_set_t)) ? (((__cpu_mask *) ((&cpuset)->__bits))[((
__cpu) / (8 * sizeof (__cpu_mask)))] |= ((__cpu_mask) 1 <<
((__cpu) % (8 * sizeof (__cpu_mask))))) : 0; }))
;
291 pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
292
293 safe_close(bus_ref);
294 sd_bus_unref(b);
295
296 switch (mode) {
297 case MODE_BISECT:
298 client_bisect(address, server_name);
299 break;
300
301 case MODE_CHART:
302 client_chart(type, address, server_name, pair[1]);
303 break;
304 }
305
306 _exit(EXIT_SUCCESS0);
307 }
308
309 CPU_ZERO(&cpuset)do __builtin_memset (&cpuset, '\0', sizeof (cpu_set_t)); while
(0)
;
38
Potential leak of memory pointed to by 'server_name'
310 CPU_SET(1, &cpuset)(__extension__ ({ size_t __cpu = (1); __cpu / 8 < (sizeof (
cpu_set_t)) ? (((__cpu_mask *) ((&cpuset)->__bits))[((
__cpu) / (8 * sizeof (__cpu_mask)))] |= ((__cpu_mask) 1 <<
((__cpu) % (8 * sizeof (__cpu_mask))))) : 0; }))
;
311 pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
312
313 server(b, &result);
314
315 if (mode == MODE_BISECT)
316 printf("Copying/memfd are equally fast at %zu bytes\n", result);
317
318 assert_se(waitpid(pid, NULL, 0) == pid)do { if ((__builtin_expect(!!(!(waitpid(pid, ((void*)0), 0) ==
pid)),0))) log_assert_failed_realm(LOG_REALM_SYSTEMD, ("waitpid(pid, NULL, 0) == pid"
), "../src/libsystemd/sd-bus/test-bus-benchmark.c", 318, __PRETTY_FUNCTION__
); } while (0)
;
319
320 safe_close(pair[1]);
321 sd_bus_unref(b);
322
323 return 0;
324}