many: fix remaining check-pointer-deref issues
The updated parsing_hacks.h file uncovered a bunch of extra things that the check-pointer-deref coccinelle script flags. This commit fixes them to make the tree check-pointer-deref clean.
This commit is contained in:
@@ -87,6 +87,8 @@ static int acquire_host_info(sd_bus *bus, HostInfo **hi) {
|
||||
_cleanup_(free_host_infop) HostInfo *host = NULL;
|
||||
int r;
|
||||
|
||||
assert(hi);
|
||||
|
||||
host = new0(HostInfo, 1);
|
||||
if (!host)
|
||||
return log_oom();
|
||||
|
||||
@@ -21,6 +21,8 @@ static int load_kernel_syscalls(Set **ret) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
/* Let's read the available system calls from the list of available tracing events. Slightly dirty,
|
||||
* but good enough for analysis purposes. */
|
||||
|
||||
|
||||
@@ -172,6 +172,8 @@ int pretty_boot_time(sd_bus *bus, char **ret) {
|
||||
BootTimes *t;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = acquire_boot_times(bus, /* require_finished= */ true, &t);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -297,6 +299,8 @@ int acquire_time_data(sd_bus *bus, bool require_finished, UnitTimes **out) {
|
||||
UnitInfo u;
|
||||
int r;
|
||||
|
||||
assert(out);
|
||||
|
||||
r = acquire_boot_times(bus, require_finished, &boot_times);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -195,6 +195,8 @@ static int find_build_dir_binary(const char *fn, char **ret) {
|
||||
|
||||
static int find_environment_binary(const char *fn, const char **ret) {
|
||||
|
||||
assert(ret);
|
||||
|
||||
/* If a path such as /usr/lib/systemd/systemd-foobar is specified, then this will check for an
|
||||
* environment variable SYSTEMD_FOOBAR_PATH and return it if set. */
|
||||
|
||||
|
||||
@@ -1256,6 +1256,8 @@ bool cg_needs_escape(const char *p) {
|
||||
int cg_escape(const char *p, char **ret) {
|
||||
_cleanup_free_ char *n = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
/* This implements very minimal escaping for names to be used as file names in the cgroup tree: any
|
||||
* name which might conflict with a kernel name or is prefixed with '_' is prefixed with a '_'. That
|
||||
* way, when reading cgroup names it is sufficient to remove a single prefixing underscore if there
|
||||
@@ -1652,6 +1654,8 @@ int cg_mask_supported_subtree(const char *root, CGroupMask *ret) {
|
||||
CGroupMask mask;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
/* Determines the mask of supported cgroup controllers. Only includes controllers we can make sense of and that
|
||||
* are actually accessible. Only covers real controllers, i.e. not the CGROUP_CONTROLLER_BPF_xyz
|
||||
* pseudo-controllers. */
|
||||
|
||||
@@ -1370,6 +1370,8 @@ int read_timestamp_file(const char *fn, usec_t *ret) {
|
||||
uint64_t t;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = read_one_line_file(fn, &ln);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1853,6 +1853,8 @@ int set_consume(Set *s, void *value) {
|
||||
int hashmap_put_strdup_full(Hashmap **h, const struct hash_ops *hash_ops, const char *k, const char *v) {
|
||||
int r;
|
||||
|
||||
assert(h);
|
||||
|
||||
r = hashmap_ensure_allocated(h, hash_ops);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -2197,6 +2199,8 @@ int _hashmap_dump_keys_sorted(HashmapBase *h, void ***ret, size_t *ret_n) {
|
||||
size_t n;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = _hashmap_dump_entries_sorted(h, &entries, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -2216,6 +2220,8 @@ int _hashmap_dump_sorted(HashmapBase *h, void ***ret, size_t *ret_n) {
|
||||
size_t n;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = _hashmap_dump_entries_sorted(h, &entries, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1076,6 +1076,8 @@ int path_split_prefix_filename(const char *path, char **ret_dir, char **ret_file
|
||||
const char *c, *next = NULL;
|
||||
int r;
|
||||
|
||||
POINTER_MAY_BE_NULL(path);
|
||||
|
||||
/* Split the path into dir prefix/filename pair. Returns:
|
||||
*
|
||||
* -EINVAL → if the path is not valid
|
||||
|
||||
@@ -667,6 +667,7 @@ char* strip_tab_ansi(char **ibuf, size_t *_isz, size_t highlight[2]) {
|
||||
|
||||
assert(ibuf);
|
||||
assert(*ibuf);
|
||||
POINTER_MAY_BE_NULL(_isz);
|
||||
|
||||
/* This does three things:
|
||||
*
|
||||
|
||||
@@ -1463,6 +1463,8 @@ int getttyname_harder(int fd, char **ret) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = getttyname_malloc(fd, &s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -39,6 +39,8 @@ static int parse_alloc_uid(const char *path, const char *name, const char *t, ui
|
||||
#endif
|
||||
|
||||
int read_login_defs(UGIDAllocationRange *ret_defs, const char *path, const char *root) {
|
||||
assert(ret_defs);
|
||||
|
||||
#if ENABLE_COMPAT_MUTABLE_UID_BOUNDARIES
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
UGIDAllocationRange defs;
|
||||
|
||||
@@ -345,6 +345,7 @@ int unit_name_unescape(const char *f, char **ret) {
|
||||
char *t;
|
||||
|
||||
assert(f);
|
||||
assert(ret);
|
||||
|
||||
r = strdup(f);
|
||||
if (!r)
|
||||
@@ -547,6 +548,8 @@ int unit_name_hash_long(const char *name, char **ret) {
|
||||
le64_t h;
|
||||
size_t len;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (strlen(name) < UNIT_NAME_MAX)
|
||||
return -EMSGSIZE;
|
||||
|
||||
|
||||
@@ -284,6 +284,9 @@ int utf8_to_ascii(const char *str, char replacement_char, char **ret) {
|
||||
/* Convert to a string that has only ASCII chars, replacing anything that is not ASCII
|
||||
* by replacement_char. */
|
||||
|
||||
assert(str);
|
||||
assert(ret);
|
||||
|
||||
_cleanup_free_ char *ans = new(char, strlen(str) + 1);
|
||||
if (!ans)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -603,6 +603,8 @@ int bpf_firewall_compile(Unit *u) {
|
||||
}
|
||||
|
||||
static int load_bpf_progs_from_fs_to_set(Unit *u, char **filter_paths, Set **set) {
|
||||
assert(set);
|
||||
|
||||
set_clear(*set);
|
||||
|
||||
STRV_FOREACH(bpf_fs_path, filter_paths) {
|
||||
|
||||
@@ -229,6 +229,7 @@ static int find_unit(Manager *m, sd_bus *bus, const char *path, Unit **unit, sd_
|
||||
assert(m);
|
||||
assert(bus);
|
||||
assert(path);
|
||||
assert(unit);
|
||||
|
||||
if (streq(path, "/org/freedesktop/systemd1/unit/self")) {
|
||||
_cleanup_(pidref_done) PidRef pidref = PIDREF_NULL;
|
||||
|
||||
@@ -2372,6 +2372,8 @@ static int exec_shared_runtime_add(
|
||||
|
||||
assert(m);
|
||||
assert(id);
|
||||
assert(tmp_dir);
|
||||
assert(var_tmp_dir);
|
||||
|
||||
/* tmp_dir, var_tmp_dir, {net,ipc}ns_storage_socket fds are donated on success */
|
||||
|
||||
|
||||
@@ -2652,6 +2652,8 @@ static int do_queue_default_job(
|
||||
Unit *target;
|
||||
int r;
|
||||
|
||||
assert(ret_error_message);
|
||||
|
||||
if (arg_default_unit)
|
||||
unit = arg_default_unit;
|
||||
else if (in_initrd())
|
||||
|
||||
@@ -2522,6 +2522,8 @@ int manager_load_startable_unit_or_warn(
|
||||
Unit *unit;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = manager_load_unit(m, name, path, &error, &unit);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to load %s %s: %s",
|
||||
|
||||
@@ -2026,6 +2026,7 @@ static int socket_chown(Socket *s, PidRef *ret_pid) {
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
assert(ret_pid);
|
||||
|
||||
r = socket_arm_timer(s, /* relative= */ true, s->timeout_usec);
|
||||
if (r < 0)
|
||||
|
||||
@@ -50,6 +50,8 @@ static int specifier_last_component(char specifier, const void *data, const char
|
||||
char *dash;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = unit_name_to_prefix(u->id, &prefix);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -132,6 +132,8 @@ int unit_new_for_name(Manager *m, size_t size, const char *name, Unit **ret) {
|
||||
_cleanup_(unit_freep) Unit *u = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
u = unit_new(m, size);
|
||||
if (!u)
|
||||
return -ENOMEM;
|
||||
@@ -4301,6 +4303,9 @@ static int user_from_unit_name(Unit *u, char **ret) {
|
||||
_cleanup_free_ char *n = NULL;
|
||||
int r;
|
||||
|
||||
assert(u);
|
||||
assert(ret);
|
||||
|
||||
r = unit_name_to_prefix(u->id, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -194,6 +194,8 @@ static int device_allow_build_json(sd_json_variant **ret, const char *name, void
|
||||
CGroupDeviceAllow *allow = userdata;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
LIST_FOREACH(device_allow, a, allow) {
|
||||
r = sd_json_variant_append_arraybo(
|
||||
&v,
|
||||
|
||||
@@ -470,48 +470,56 @@ static int private_bpf_delegate_commands_build_json(sd_json_variant **ret, const
|
||||
ExecContext *c = ASSERT_PTR(userdata);
|
||||
_cleanup_free_ char *v = bpf_delegate_commands_to_string(c->bpf_delegate_commands);
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (!v) {
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sd_json_variant_new_string(ASSERT_PTR(ret), v);
|
||||
return sd_json_variant_new_string(ret, v);
|
||||
}
|
||||
|
||||
static int private_bpf_delegate_maps_build_json(sd_json_variant **ret, const char *name, void *userdata) {
|
||||
ExecContext *c = ASSERT_PTR(userdata);
|
||||
_cleanup_free_ char *v = bpf_delegate_maps_to_string(c->bpf_delegate_maps);
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (!v) {
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sd_json_variant_new_string(ASSERT_PTR(ret), v);
|
||||
return sd_json_variant_new_string(ret, v);
|
||||
}
|
||||
|
||||
static int private_bpf_delegate_programs_build_json(sd_json_variant **ret, const char *name, void *userdata) {
|
||||
ExecContext *c = ASSERT_PTR(userdata);
|
||||
_cleanup_free_ char *v = bpf_delegate_programs_to_string(c->bpf_delegate_programs);
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (!v) {
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sd_json_variant_new_string(ASSERT_PTR(ret), v);
|
||||
return sd_json_variant_new_string(ret, v);
|
||||
}
|
||||
|
||||
static int private_bpf_delegate_attachments_build_json(sd_json_variant **ret, const char *name, void *userdata) {
|
||||
ExecContext *c = ASSERT_PTR(userdata);
|
||||
_cleanup_free_ char *v = bpf_delegate_attachments_to_string(c->bpf_delegate_attachments);
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (!v) {
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sd_json_variant_new_string(ASSERT_PTR(ret), v);
|
||||
return sd_json_variant_new_string(ret, v);
|
||||
}
|
||||
|
||||
static int syscall_filter_build_json(sd_json_variant **ret, const char *name, void *userdata) {
|
||||
|
||||
@@ -153,6 +153,7 @@ static int get_process_container_parent_cmdline(PidRef *pid, char** ret_cmdline)
|
||||
|
||||
assert(pidref_is_set(pid));
|
||||
assert(!pidref_is_remote(pid));
|
||||
assert(ret_cmdline);
|
||||
|
||||
r = pidref_from_same_root_fs(pid, &PIDREF_MAKE_FROM_PID(1));
|
||||
if (r < 0)
|
||||
|
||||
@@ -14,6 +14,8 @@ static int uri_set_private_class(const char *uri, char **ret_uri) {
|
||||
_cleanup_free_ char *private_uri = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret_uri);
|
||||
|
||||
r = uri_from_string(uri, &p11kit_uri);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to parse PKCS#11 URI '%s': %m", uri);
|
||||
|
||||
@@ -242,6 +242,8 @@ int acquire_hibernate_info(HibernateInfo *ret) {
|
||||
_cleanup_(hibernate_info_done) HibernateInfo i = {};
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = get_kernel_hibernate_location(&i.cmdline);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -3658,6 +3658,8 @@ static int parse_environment_field(sd_json_variant **identity, const char *field
|
||||
static int parse_language_field(char ***languages, const char *arg) {
|
||||
int r;
|
||||
|
||||
assert(languages);
|
||||
|
||||
if (isempty(arg)) {
|
||||
r = drop_from_identity("preferredLanguage", "additionalLanguages");
|
||||
if (r < 0)
|
||||
|
||||
@@ -801,6 +801,8 @@ static int bus_home_object_find(
|
||||
Home *h;
|
||||
int r;
|
||||
|
||||
assert(found);
|
||||
|
||||
r = sd_bus_path_decode(path, "/org/freedesktop/home1/home", &e);
|
||||
if (r <= 0)
|
||||
return 0;
|
||||
|
||||
@@ -805,6 +805,7 @@ static int crypt_device_to_evp_cipher(struct crypt_device *cd, const EVP_CIPHER
|
||||
int r;
|
||||
|
||||
assert(cd);
|
||||
assert(ret);
|
||||
|
||||
/* Let's find the right OpenSSL EVP_CIPHER object that matches the encryption settings of the LUKS
|
||||
* device */
|
||||
@@ -857,6 +858,7 @@ static int luks_validate_home_record(
|
||||
|
||||
assert(cd);
|
||||
assert(h);
|
||||
assert(ret_luks_home_record);
|
||||
|
||||
for (int token = 0; token < sym_crypt_token_max(CRYPT_LUKS2); token++) {
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *v = NULL, *rr = NULL;
|
||||
@@ -1918,6 +1920,7 @@ static int make_partition_table(
|
||||
assert(label);
|
||||
assert(ret_offset);
|
||||
assert(ret_size);
|
||||
assert(ret_disk_uuid);
|
||||
|
||||
t = fdisk_new_parttype();
|
||||
if (!t)
|
||||
@@ -2786,6 +2789,7 @@ static int prepare_resize_partition(
|
||||
assert(fd >= 0);
|
||||
assert(ret_disk_uuid);
|
||||
assert(ret_table);
|
||||
assert(ret_partition);
|
||||
|
||||
assert((partition_offset & 511) == 0);
|
||||
assert((old_partition_size & 511) == 0);
|
||||
|
||||
@@ -915,6 +915,7 @@ static int home_activate(UserRecord *h, UserRecord **ret_home) {
|
||||
int r;
|
||||
|
||||
assert(h);
|
||||
assert(ret_home);
|
||||
|
||||
if (!h->user_name)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "User record lacks user name, refusing.");
|
||||
|
||||
@@ -197,6 +197,7 @@ int user_record_reconcile(
|
||||
|
||||
assert(host);
|
||||
assert(embedded);
|
||||
assert(ret);
|
||||
|
||||
/* Make sure both records are initialized */
|
||||
if (!host->json || !embedded->json)
|
||||
|
||||
@@ -398,6 +398,8 @@ static int get_hardware_sku(Context *c, char **ret) {
|
||||
_cleanup_free_ char *model = NULL, *sku = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = get_dmi_property(c, "ID_SKU", &sku);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -419,6 +421,8 @@ static int get_hardware_version(Context *c, char **ret) {
|
||||
_cleanup_free_ char *version = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = get_dmi_property(c, "ID_HARDWARE_VERSION", &version);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -207,6 +207,8 @@ int curl_glue_new(CurlGlue **glue, sd_event *event) {
|
||||
_cleanup_(sd_event_unrefp) sd_event *e = NULL;
|
||||
int r;
|
||||
|
||||
assert(glue);
|
||||
|
||||
if (event)
|
||||
e = sd_event_ref(event);
|
||||
else {
|
||||
|
||||
@@ -153,7 +153,8 @@ int oci_ref_normalize(char **protocol, char **registry, char **image, char **tag
|
||||
|
||||
assert(protocol);
|
||||
assert(registry);
|
||||
assert(image && *image);
|
||||
assert(image);
|
||||
assert(*image);
|
||||
assert(tag);
|
||||
|
||||
/* OCI container reference are supposed to have the form <registry>/<name>:<tag>. Except that it's
|
||||
@@ -379,6 +380,7 @@ static const char *const go_arch_table[_ARCHITECTURE_MAX] = {
|
||||
DEFINE_STRING_TABLE_LOOKUP_FROM_STRING(go_arch, Architecture);
|
||||
|
||||
char* urlescape(const char *s) {
|
||||
POINTER_MAY_BE_NULL(s);
|
||||
size_t l = strlen_ptr(s);
|
||||
|
||||
_cleanup_free_ char *t = new(char, l * 3 + 1);
|
||||
|
||||
@@ -678,6 +678,7 @@ int pull_job_restart_with_signature(PullJob *j, char **ret) {
|
||||
int r;
|
||||
|
||||
assert(j);
|
||||
assert(ret);
|
||||
|
||||
/* Generic implementation of a PullJobNotFound handler, that restarts the job requesting a different
|
||||
* signature file. After the initial file, additional *.sha256.gpg, SHA256SUMS.gpg and SHA256SUMS.asc
|
||||
|
||||
@@ -46,6 +46,8 @@ static int normalize_local(const char *local, const char *url, char **ret) {
|
||||
_cleanup_free_ char *ll = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (arg_import_flags & IMPORT_DIRECT) {
|
||||
|
||||
if (!local)
|
||||
|
||||
@@ -815,6 +815,8 @@ static int get_virtualization(char **v) {
|
||||
char *b = NULL;
|
||||
int r;
|
||||
|
||||
assert(v);
|
||||
|
||||
r = sd_bus_default_system(&bus);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -463,7 +463,9 @@ static int manager_find_user_journal(Manager *m, uid_t uid, JournalFile **ret) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
assert(!uid_for_system_journal(uid));
|
||||
assert(ret);
|
||||
|
||||
f = ordered_hashmap_get(m->user_journals, UID_TO_PTR(uid));
|
||||
if (f)
|
||||
|
||||
@@ -1128,6 +1128,7 @@ static int kernel_from_version(const char *version, char **ret_kernel) {
|
||||
int r;
|
||||
|
||||
assert(version);
|
||||
assert(ret_kernel);
|
||||
|
||||
vmlinuz = path_join("/usr/lib/modules/", version, "/vmlinuz");
|
||||
if (!vmlinuz)
|
||||
|
||||
@@ -418,6 +418,8 @@ int bus_message_from_malloc(
|
||||
size_t sz;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = message_from_header(
|
||||
bus,
|
||||
buffer, length,
|
||||
|
||||
@@ -27,6 +27,8 @@ typedef enum Type {
|
||||
static void server(sd_bus *b, size_t *result) {
|
||||
int r;
|
||||
|
||||
assert(result);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
static void prepare_loopback(sd_device **ret) {
|
||||
_cleanup_(sd_device_unrefp) sd_device *dev = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
ASSERT_OK(sd_device_new_from_syspath(&dev, "/sys/class/net/lo"));
|
||||
ASSERT_OK(device_add_property(dev, "ACTION", "add"));
|
||||
ASSERT_OK(device_add_property(dev, "SEQNUM", "10"));
|
||||
@@ -32,6 +34,8 @@ static int prepare_sda(sd_device **ret) {
|
||||
_cleanup_(sd_device_unrefp) sd_device *dev = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_device_new_from_subsystem_sysname(&dev, "block", "sda");
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -55,6 +59,9 @@ static int monitor_handler(sd_device_monitor *m, sd_device *d, void *userdata) {
|
||||
static void prepare_monitor(sd_device_monitor **ret_server, sd_device_monitor **ret_client, union sockaddr_union *ret_address) {
|
||||
_cleanup_(sd_device_monitor_unrefp) sd_device_monitor *monitor_server = NULL, *monitor_client = NULL;
|
||||
|
||||
assert(ret_server);
|
||||
assert(ret_client);
|
||||
|
||||
ASSERT_OK(device_monitor_new_full(&monitor_server, MONITOR_GROUP_NONE, -EBADF));
|
||||
ASSERT_OK(sd_device_monitor_set_description(monitor_server, "sender"));
|
||||
ASSERT_OK(sd_device_monitor_start(monitor_server, NULL, NULL));
|
||||
|
||||
@@ -351,6 +351,9 @@ static void test_sd_device_enumerator_filter_subsystem_one(
|
||||
unsigned n_new_dev = 0, n_removed_dev = 0;
|
||||
sd_device *dev;
|
||||
|
||||
assert(ret_n_new_dev);
|
||||
assert(ret_n_removed_dev);
|
||||
|
||||
ASSERT_OK(sd_device_enumerator_new(&e));
|
||||
ASSERT_OK(sd_device_enumerator_add_match_subsystem(e, subsystem, true));
|
||||
exclude_problematic_devices(e);
|
||||
|
||||
@@ -222,6 +222,8 @@ static void setup_unreferenced_data(void) {
|
||||
static void mkdtemp_chdir_chattr(const char *template, char **ret) {
|
||||
_cleanup_(rm_rf_physical_and_freep) char *path = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
ASSERT_OK(mkdtemp_malloc(template, &path));
|
||||
ASSERT_OK_ERRNO(chdir(path));
|
||||
|
||||
|
||||
@@ -242,6 +242,8 @@ int sd_nfnl_nft_message_new_basechain(
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_nfnl_message_new(nfnl, &m, nfproto, NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWCHAIN, NLM_F_CREATE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -287,6 +289,8 @@ int sd_nfnl_nft_message_new_table(
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_nfnl_message_new(nfnl, &m, nfproto, NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWTABLE, NLM_F_CREATE | NLM_F_EXCL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -309,6 +313,8 @@ int sd_nfnl_nft_message_new_rule(
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_nfnl_message_new(nfnl, &m, nfproto, NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWRULE, NLM_F_CREATE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -337,6 +343,8 @@ int sd_nfnl_nft_message_new_set(
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_nfnl_message_new(nfnl, &m, nfproto, NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWSET, NLM_F_CREATE);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -372,6 +380,8 @@ int sd_nfnl_nft_message_new_setelems(
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (add)
|
||||
r = sd_nfnl_message_new(nfnl, &m, nfproto, NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWSETELEM, NLM_F_CREATE);
|
||||
else
|
||||
|
||||
@@ -608,6 +608,8 @@ static void remove_dummy_interfacep(int *ifindex) {
|
||||
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *message = NULL;
|
||||
|
||||
POINTER_MAY_BE_NULL(ifindex);
|
||||
|
||||
if (!ifindex || *ifindex <= 0)
|
||||
return;
|
||||
|
||||
|
||||
@@ -840,6 +840,7 @@ static int varlink_idl_subparse_field_type(
|
||||
assert(p);
|
||||
assert(*p);
|
||||
assert(line);
|
||||
assert(column);
|
||||
assert(field);
|
||||
|
||||
r = varlink_idl_subparse_whitespace(p, line, column);
|
||||
@@ -1171,6 +1172,9 @@ _public_ int sd_varlink_idl_parse(
|
||||
|
||||
_cleanup_(sd_varlink_interface_freep) sd_varlink_interface *interface = NULL;
|
||||
_cleanup_(varlink_symbol_freep) sd_varlink_symbol *symbol = NULL;
|
||||
|
||||
assert_return(ret, -EINVAL);
|
||||
|
||||
enum {
|
||||
STATE_PRE_INTERFACE,
|
||||
STATE_INTERFACE,
|
||||
|
||||
@@ -175,6 +175,8 @@ int varlink_server_new(
|
||||
_cleanup_(sd_varlink_server_unrefp) sd_varlink_server *s = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_varlink_server_new(&s, flags|SD_VARLINK_SERVER_FD_PASSING_INPUT_STRICT);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to allocate varlink server object: %m");
|
||||
|
||||
@@ -90,6 +90,7 @@ static int get_sender_session(
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
assert(ret);
|
||||
|
||||
/* Acquire the sender's session. This first checks if the sending process is inside a session itself,
|
||||
* and returns that. If not and 'consult_display' is true, this returns the display session of the
|
||||
@@ -165,6 +166,8 @@ static int get_sender_user(Manager *m, sd_bus_message *message, sd_bus_error *er
|
||||
User *user;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
/* Note that we get the owner UID of the session, not the actual client UID here! */
|
||||
r = sd_bus_query_sender_creds(message, SD_BUS_CREDS_OWNER_UID|SD_BUS_CREDS_AUGMENT, &creds);
|
||||
if (r < 0)
|
||||
|
||||
@@ -193,6 +193,7 @@ static int call_get_addresses(
|
||||
assert(name);
|
||||
assert(prefix);
|
||||
assert(prefix2);
|
||||
assert(ret);
|
||||
|
||||
r = bus_call_method(bus, bus_machine_mgr, "GetMachineAddresses", NULL, &reply, "s", name);
|
||||
if (r < 0)
|
||||
|
||||
@@ -257,6 +257,8 @@ static int machine_add_from_params(
|
||||
assert(message);
|
||||
assert(name);
|
||||
assert(c == _MACHINE_CLASS_INVALID || MACHINE_CLASS_CAN_REGISTER(c));
|
||||
assert(leader_pidref);
|
||||
assert(supervisor_pidref);
|
||||
assert(ret);
|
||||
|
||||
if (leader_pidref->pid == 1)
|
||||
|
||||
@@ -639,6 +639,8 @@ static int pcr_states_allocate(PcrState **ret) {
|
||||
_cleanup_(pcr_state_free_all) PcrState *pcr_states = NULL;
|
||||
size_t n = 0;
|
||||
|
||||
assert(ret);
|
||||
|
||||
pcr_states = new0(PcrState, strv_length(arg_banks) + 1);
|
||||
if (!pcr_states)
|
||||
return log_oom();
|
||||
|
||||
@@ -69,6 +69,8 @@ int manager_new(Manager **ret) {
|
||||
_cleanup_(manager_freep) Manager *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
m = new(Manager, 1);
|
||||
if (!m)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -86,6 +86,7 @@ static int netdev_create_fou_tunnel_message(NetDev *netdev, sd_netlink_message *
|
||||
|
||||
assert(netdev);
|
||||
assert(netdev->manager);
|
||||
assert(ret);
|
||||
|
||||
r = sd_genl_message_new(netdev->manager->genl, FOU_GENL_NAME, FOU_CMD_ADD, &m);
|
||||
if (r < 0)
|
||||
|
||||
@@ -104,6 +104,7 @@ static int netdev_l2tp_create_message_tunnel(NetDev *netdev, union in_addr_union
|
||||
assert(local_address);
|
||||
assert(netdev);
|
||||
assert(netdev->manager);
|
||||
assert(ret);
|
||||
|
||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *m = NULL;
|
||||
uint16_t encap_type;
|
||||
@@ -200,6 +201,7 @@ static int netdev_l2tp_create_message_session(NetDev *netdev, L2tpSession *sessi
|
||||
assert(netdev->manager);
|
||||
assert(session);
|
||||
assert(session->tunnel);
|
||||
assert(ret);
|
||||
|
||||
r = sd_genl_message_new(netdev->manager->genl, L2TP_GENL_NAME, L2TP_CMD_SESSION_CREATE, &m);
|
||||
if (r < 0)
|
||||
|
||||
@@ -239,6 +239,7 @@ static int netdev_macsec_create_message(NetDev *netdev, int command, sd_netlink_
|
||||
assert(netdev);
|
||||
assert(netdev->ifindex > 0);
|
||||
assert(netdev->manager);
|
||||
assert(ret);
|
||||
|
||||
r = sd_genl_message_new(netdev->manager->genl, MACSEC_GENL_NAME, command, &m);
|
||||
if (r < 0)
|
||||
|
||||
@@ -173,6 +173,8 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
|
||||
int address_new(Address **ret) {
|
||||
_cleanup_(address_unrefp) Address *address = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
address = new(Address, 1);
|
||||
if (!address)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -456,6 +456,9 @@ static int dhcp4_server_parse_dns_server_string_and_warn(
|
||||
struct in_addr **addresses,
|
||||
size_t *n_addresses) {
|
||||
|
||||
assert(addresses);
|
||||
assert(n_addresses);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *word = NULL, *server_name = NULL;
|
||||
union in_addr_union address;
|
||||
|
||||
@@ -202,6 +202,10 @@ static int dhcp6_request_address(
|
||||
Address *existing;
|
||||
int r;
|
||||
|
||||
assert(link);
|
||||
assert(server_address);
|
||||
assert(ip6_addr);
|
||||
|
||||
r = address_new(&addr);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
@@ -677,6 +677,8 @@ static int persistent_storage_open(void) {
|
||||
int manager_new(Manager **ret, bool test_mode) {
|
||||
_cleanup_(manager_freep) Manager *m = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
m = new(Manager, 1);
|
||||
if (!m)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -131,6 +131,8 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
|
||||
int nexthop_new(NextHop **ret) {
|
||||
_cleanup_(nexthop_unrefp) NextHop *nexthop = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
nexthop = new(NextHop, 1);
|
||||
if (!nexthop)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -245,6 +245,8 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
|
||||
int route_new(Route **ret) {
|
||||
_cleanup_(route_unrefp) Route *route = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
route = new(Route, 1);
|
||||
if (!route)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -115,6 +115,8 @@ static int qdisc_new(QDiscKind kind, QDisc **ret) {
|
||||
_cleanup_(qdisc_unrefp) QDisc *qdisc = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (kind == _QDISC_KIND_INVALID) {
|
||||
qdisc = new(QDisc, 1);
|
||||
if (!qdisc)
|
||||
|
||||
@@ -77,6 +77,8 @@ static int tclass_new(TClassKind kind, TClass **ret) {
|
||||
_cleanup_(tclass_unrefp) TClass *tclass = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (kind == _TCLASS_KIND_INVALID) {
|
||||
tclass = new(TClass, 1);
|
||||
if (!tclass)
|
||||
|
||||
@@ -757,12 +757,13 @@ int mount_all(const char *dest,
|
||||
}
|
||||
|
||||
static int parse_mount_bind_options(const char *options, unsigned long *open_tree_flags, char **mount_opts, RemountIdmapping *idmapping) {
|
||||
unsigned long flags = *open_tree_flags;
|
||||
unsigned long flags = *ASSERT_PTR(open_tree_flags);
|
||||
char *opts = NULL;
|
||||
RemountIdmapping new_idmapping = *idmapping;
|
||||
RemountIdmapping new_idmapping = *ASSERT_PTR(idmapping);
|
||||
int r;
|
||||
|
||||
assert(options);
|
||||
assert(mount_opts);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *word = NULL;
|
||||
|
||||
@@ -177,6 +177,7 @@ int setup_veth(const char *machine_name,
|
||||
assert(machine_name);
|
||||
assert(pidref_is_set(pid));
|
||||
assert(iface_name);
|
||||
assert(provided_mac);
|
||||
|
||||
/* Use two different interface name prefixes depending whether
|
||||
* we are in bridge mode or not. */
|
||||
|
||||
@@ -2082,6 +2082,7 @@ int oci_load(FILE *f, const char *bundle, Settings **ret) {
|
||||
int r;
|
||||
|
||||
assert_se(bundle);
|
||||
assert(ret);
|
||||
|
||||
path = strjoina(bundle, "/config.json");
|
||||
|
||||
|
||||
@@ -445,6 +445,8 @@ static int parse_capability_spec(const char *spec, uint64_t *ret_mask) {
|
||||
uint64_t mask = 0;
|
||||
int r;
|
||||
|
||||
assert(ret_mask);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ int manager_new(Manager **ret) {
|
||||
_cleanup_(manager_freep) Manager *m = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
m = new(Manager, 1);
|
||||
if (!m)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -50,6 +50,8 @@ static int connect_to_resolved(sd_varlink **ret) {
|
||||
_cleanup_(sd_varlink_unrefp) sd_varlink *link = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = sd_varlink_connect_address(&link, "/run/systemd/resolve/io.systemd.Resolve");
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -261,6 +261,7 @@ static int escape_and_truncate_data(const void *data, size_t size, char **ret) {
|
||||
_cleanup_free_ char *safe = NULL;
|
||||
|
||||
assert(data || size == 0);
|
||||
assert(ret);
|
||||
|
||||
if (size > EXTENSION_STRING_SAFE_LIMIT) {
|
||||
safe = cescape_length(data, EXTENSION_STRING_SAFE_LIMIT);
|
||||
|
||||
@@ -2456,6 +2456,8 @@ static int event_log_load_and_process(EventLog **ret) {
|
||||
_cleanup_(event_log_freep) EventLog *el = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
el = event_log_new();
|
||||
if (!el)
|
||||
return log_oom();
|
||||
@@ -3613,6 +3615,7 @@ static int pcrlock_file_system_path(const char *normalized_path, char **ret) {
|
||||
_cleanup_free_ char *s = NULL;
|
||||
|
||||
assert(normalized_path);
|
||||
assert(ret);
|
||||
|
||||
if (path_equal(normalized_path, "/"))
|
||||
s = strdup(PCRLOCK_ROOT_FILE_SYSTEM_PATH);
|
||||
|
||||
@@ -132,6 +132,8 @@ static int extract_prefix(const char *path, char **ret) {
|
||||
size_t m;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = path_extract_filename(path, &bn);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -2691,6 +2691,8 @@ static int parse_key_file(const char *filename, struct iovec *key) {
|
||||
size_t n = 0;
|
||||
int r;
|
||||
|
||||
assert(key);
|
||||
|
||||
r = read_full_file_full(
|
||||
AT_FDCWD, filename,
|
||||
/* offset= */ UINT64_MAX,
|
||||
@@ -4383,6 +4385,8 @@ static int partition_hint(const Partition *p, const char *node, char **ret) {
|
||||
const char *label;
|
||||
sd_id128_t id;
|
||||
|
||||
assert(ret);
|
||||
|
||||
/* Tries really hard to find a suitable description for this partition */
|
||||
|
||||
if (p->definition_path)
|
||||
|
||||
@@ -284,6 +284,9 @@ static int io_stat_parse(const char *cgroup_path, uint64_t *ret_rbytes, uint64_t
|
||||
uint64_t rbytes = 0, rios = 0;
|
||||
int r;
|
||||
|
||||
assert(ret_rbytes);
|
||||
assert(ret_rios);
|
||||
|
||||
r = cg_get_path(cgroup_path, "io.stat", &path);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -337,6 +337,7 @@ static int output_collected_list(Context *context, Table **ret) {
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
assert(ret);
|
||||
|
||||
_cleanup_(table_unrefp) Table *table = table_new("family", "object", "fields", "value");
|
||||
if (!table)
|
||||
@@ -391,6 +392,7 @@ static int output_collected_describe(Context *context, Table **ret) {
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
assert(ret);
|
||||
|
||||
_cleanup_(table_unrefp) Table *table = table_new("family", "type", "description");
|
||||
if (!table)
|
||||
@@ -442,6 +444,7 @@ static int facts_output_list(Context *context, Table **ret) {
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
assert(ret);
|
||||
|
||||
_cleanup_(table_unrefp) Table *table = table_new("family", "object", "value");
|
||||
if (!table)
|
||||
@@ -493,6 +496,7 @@ static int facts_output_describe(Context *context, Table **ret) {
|
||||
int r;
|
||||
|
||||
assert(context);
|
||||
assert(ret);
|
||||
|
||||
_cleanup_(table_unrefp) Table *table = table_new("family", "description");
|
||||
if (!table)
|
||||
|
||||
@@ -2057,6 +2057,8 @@ static int dnssec_test_positive_wildcard_nsec(
|
||||
bool authenticated = true;
|
||||
int r;
|
||||
|
||||
assert(_authenticated);
|
||||
|
||||
/* Run a positive NSEC wildcard proof. Specifically:
|
||||
*
|
||||
* A proof that there's neither a wildcard name nor a non-wildcard name that is a suffix of the name "name" and
|
||||
|
||||
@@ -98,6 +98,8 @@ static int synthesize_localhost_rr(Manager *m, const DnsResourceKey *key, DnsAns
|
||||
static int answer_add_ptr(DnsAnswer **answer, const char *from, const char *to, int ifindex, DnsAnswerFlags flags) {
|
||||
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
|
||||
|
||||
assert(answer);
|
||||
|
||||
rr = dns_resource_record_new_full(DNS_CLASS_IN, DNS_TYPE_PTR, from);
|
||||
if (!rr)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -3300,7 +3300,9 @@ static int dnssec_validate_records(
|
||||
DnsResourceRecord *rr;
|
||||
int r;
|
||||
|
||||
assert(have_nsec);
|
||||
assert(nvalidations);
|
||||
assert(validated);
|
||||
|
||||
/* Returns negative on error, 0 if validation failed, 1 to restart validation, 2 when finished. */
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(
|
||||
static int load_static_record_file_item(sd_json_variant *rj, Hashmap **records) {
|
||||
int r;
|
||||
|
||||
assert(records);
|
||||
|
||||
_cleanup_(dns_resource_record_unrefp) DnsResourceRecord *rr = NULL;
|
||||
r = dns_resource_record_from_json(rj, &rr);
|
||||
if (r < 0)
|
||||
|
||||
@@ -211,6 +211,9 @@ static int find_addr_records(
|
||||
DnsResourceRecord *rr;
|
||||
int ifindex, r;
|
||||
|
||||
assert(q);
|
||||
POINTER_MAY_BE_NULL(canonical);
|
||||
|
||||
DNS_ANSWER_FOREACH_IFINDEX(rr, ifindex, q->answer) {
|
||||
_cleanup_(sd_json_variant_unrefp) sd_json_variant *entry = NULL;
|
||||
int family;
|
||||
|
||||
@@ -18,6 +18,8 @@ static void prefix_random(const char *name, char **ret) {
|
||||
uint64_t i, u;
|
||||
char *m = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
u = 1 + (random_u64() & 3);
|
||||
|
||||
for (i = 0; i < u; i++) {
|
||||
|
||||
@@ -1056,6 +1056,7 @@ static int pe_find_addon_sections(
|
||||
|
||||
assert(fd >= 0);
|
||||
assert(path);
|
||||
assert(ret_cmdline);
|
||||
|
||||
r = pe_load_headers_and_sections(fd, path, §ions, &pe_header);
|
||||
if (r < 0)
|
||||
|
||||
@@ -152,6 +152,8 @@ int bpf_program_new(uint32_t prog_type, const char *prog_name, BPFProgram **ret)
|
||||
_cleanup_(bpf_program_freep) BPFProgram *p = NULL;
|
||||
_cleanup_free_ char *name = NULL;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (prog_name) {
|
||||
if (strlen(prog_name) >= BPF_OBJ_NAME_LEN)
|
||||
return -ENAMETOOLONG;
|
||||
|
||||
@@ -1175,6 +1175,8 @@ static int bus_append_import_credential(sd_bus_message *m, const char *field, co
|
||||
static int bus_append_refresh_on_reload(sd_bus_message *m, const char *field, const char *eq) {
|
||||
int r;
|
||||
|
||||
assert(eq);
|
||||
|
||||
r = sd_bus_message_open_container(m, 'r', "sv");
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
@@ -1285,6 +1285,7 @@ static int find_next(const CalendarSpec *spec, struct tm *tm, usec_t *usec) {
|
||||
|
||||
assert(spec);
|
||||
assert(tm);
|
||||
assert(usec);
|
||||
|
||||
c = *tm;
|
||||
tm_usec = *usec;
|
||||
|
||||
@@ -413,6 +413,8 @@ int show_cgroup_get_path_and_warn(
|
||||
_cleanup_free_ char *root = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
if (machine) {
|
||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
||||
_cleanup_free_ char *unit = NULL;
|
||||
|
||||
@@ -189,6 +189,9 @@ static int parse_line(
|
||||
assert(line > 0);
|
||||
assert(lookup);
|
||||
assert(l);
|
||||
assert(section);
|
||||
assert(section_line);
|
||||
assert(section_ignored);
|
||||
|
||||
l = strstrip(l);
|
||||
if (isempty(l))
|
||||
|
||||
@@ -275,6 +275,8 @@ int read_credential_strings_many_internal(
|
||||
bool all = true;
|
||||
int r, ret = 0;
|
||||
|
||||
assert(first_value);
|
||||
|
||||
/* Reads a bunch of credentials into the specified buffers. If the specified buffers are already
|
||||
* non-NULL frees them if a credential is found. Only supports string-based credentials
|
||||
* (i.e. refuses embedded NUL bytes).
|
||||
@@ -338,6 +340,9 @@ int get_credential_user_password(const char *username, char **ret_password, bool
|
||||
_cleanup_free_ char *cn = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret_password);
|
||||
assert(ret_is_hashed);
|
||||
|
||||
/* Try to pick up the password for this account via the credentials logic */
|
||||
cn = strjoin("passwd.hashed-password.", username);
|
||||
if (!cn)
|
||||
|
||||
@@ -214,6 +214,8 @@ int cryptsetup_get_volume_key_prefix(
|
||||
const char *uuid;
|
||||
char *s;
|
||||
|
||||
assert(ret);
|
||||
|
||||
uuid = sym_crypt_get_uuid(cd);
|
||||
if (!uuid)
|
||||
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to get LUKS UUID.");
|
||||
@@ -248,6 +250,8 @@ int cryptsetup_get_volume_key_id(
|
||||
char *hex;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = cryptsetup_get_volume_key_prefix(cd, volume_name, &prefix);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to get LUKS volume key prefix.");
|
||||
|
||||
@@ -942,6 +942,7 @@ static int dissect_image_from_unpartitioned(
|
||||
assert(devname);
|
||||
assert(m);
|
||||
assert(fstype);
|
||||
POINTER_MAY_BE_NULL(mount_node_fd);
|
||||
|
||||
if (!image_filter_test(filter, PARTITION_ROOT, /* label= */ NULL)) /* do a filter check with an empty partition label */
|
||||
return -ECOMM;
|
||||
|
||||
@@ -574,6 +574,8 @@ int dns_answer_remove_by_answer_keys(DnsAnswer **a, DnsAnswer *b) {
|
||||
DnsAnswerItem *item;
|
||||
int r;
|
||||
|
||||
assert(a);
|
||||
|
||||
/* Removes all items from '*a' that have a matching key in 'b' */
|
||||
|
||||
DNS_ANSWER_FOREACH_ITEM(item, b) {
|
||||
|
||||
@@ -1519,6 +1519,7 @@ int dns_packet_read_string(DnsPacket *p, char **ret, size_t *start) {
|
||||
int r;
|
||||
|
||||
assert(p);
|
||||
assert(ret);
|
||||
|
||||
r = dns_packet_read_uint8(p, &c, NULL);
|
||||
if (r < 0)
|
||||
@@ -2448,6 +2449,8 @@ static int dns_packet_extract_question(DnsPacket *p, DnsQuestion **ret_question)
|
||||
unsigned n;
|
||||
int r;
|
||||
|
||||
assert(ret_question);
|
||||
|
||||
n = DNS_PACKET_QDCOUNT(p);
|
||||
if (n > 0) {
|
||||
question = dns_question_new(n);
|
||||
@@ -2501,6 +2504,8 @@ static int dns_packet_extract_answer(DnsPacket *p, DnsAnswer **ret_answer) {
|
||||
bool bad_opt = false;
|
||||
int r;
|
||||
|
||||
assert(ret_answer);
|
||||
|
||||
n = DNS_PACKET_RRCOUNT(p);
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
@@ -2012,6 +2012,7 @@ int dns_resource_record_get_cname_target(DnsResourceKey *key, DnsResourceRecord
|
||||
|
||||
assert(key);
|
||||
assert(cname);
|
||||
assert(ret);
|
||||
|
||||
/* Checks if the RR `cname` is a CNAME/DNAME RR that matches the specified `key`. If so, returns the
|
||||
* target domain. If not, returns -EUNATCH */
|
||||
|
||||
@@ -140,6 +140,7 @@ int parse_env_extension_hierarchies(char ***ret_hierarchies, const char *hierarc
|
||||
_cleanup_free_ char **l = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret_hierarchies);
|
||||
assert(hierarchy_env);
|
||||
r = getenv_path_list(hierarchy_env, &l);
|
||||
if (r == -ENXIO) {
|
||||
|
||||
@@ -14,6 +14,8 @@ int fido2_generate_salt(struct iovec *ret_salt) {
|
||||
_cleanup_(iovec_done) struct iovec salt = {};
|
||||
int r;
|
||||
|
||||
assert(ret_salt);
|
||||
|
||||
r = crypto_random_bytes_allocate_iovec(FIDO2_SALT_SIZE, &salt);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to generate FIDO2 salt: %m");
|
||||
@@ -27,6 +29,8 @@ int fido2_read_salt_file(const char *filename, uint64_t offset, const char *clie
|
||||
_cleanup_free_ char *bind_name = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret_salt);
|
||||
|
||||
/* If we read the salt via AF_UNIX, make the client recognizable */
|
||||
if (asprintf(&bind_name, "@%" PRIx64"/%s-fido2-salt/%s", random_u64(), client, node) < 0)
|
||||
return log_oom();
|
||||
|
||||
@@ -190,6 +190,8 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se
|
||||
const char *filename, uint16_t file_priority, uint32_t line_number, bool compat) {
|
||||
int r = 0;
|
||||
|
||||
assert(node);
|
||||
|
||||
for (size_t i = 0;; i++) {
|
||||
size_t p;
|
||||
char c;
|
||||
|
||||
@@ -12,6 +12,8 @@ static int specifier_prefix_and_instance(char specifier, const void *data, const
|
||||
_cleanup_free_ char *prefix = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret);
|
||||
|
||||
r = unit_name_to_prefix_and_instance(i->name, &prefix);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1861,6 +1861,8 @@ int unit_file_verify_alias(
|
||||
_cleanup_free_ char *dst_updated = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret_dst);
|
||||
|
||||
/* Verify that dst is a valid either a valid alias or a valid .wants/.requires symlink for the target
|
||||
* unit *i. Return negative on error or if not compatible, zero on success.
|
||||
*
|
||||
@@ -2903,6 +2905,9 @@ static int do_unit_file_disable(
|
||||
bool has_install_info = false;
|
||||
int r;
|
||||
|
||||
assert(changes);
|
||||
assert(n_changes);
|
||||
|
||||
STRV_FOREACH(name, names) {
|
||||
InstallInfo *info;
|
||||
|
||||
|
||||
@@ -1153,6 +1153,12 @@ static int check_device_is_fido2_with_hmac_secret(
|
||||
_cleanup_(fido_dev_free_wrapper) fido_dev_t *d = NULL;
|
||||
int r;
|
||||
|
||||
assert(ret_has_rk);
|
||||
assert(ret_has_client_pin);
|
||||
assert(ret_has_up);
|
||||
assert(ret_has_uv);
|
||||
assert(ret_has_always_uv);
|
||||
|
||||
d = sym_fido_dev_new();
|
||||
if (!d)
|
||||
return log_oom();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user