Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 41d1b3e8 authored by John Johansen's avatar John Johansen
Browse files

apparmor: Fix smatch warning in aa_remove_profiles



smatch reports
  error: potential NULL dereference 'ns'.

this can not actually occur because it relies on aa_split_fqname setting
both ns_name and name as null but ns_name will actually always have a
value in this case.

so remove the unnecessary if (ns_name) conditional that is resulting
in the false positive further down.

Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent b492d50b
Loading
Loading
Loading
Loading
+6 −8
Original line number Original line Diff line number Diff line
@@ -1156,7 +1156,6 @@ ssize_t aa_remove_profiles(char *fqname, size_t size)
	if (fqname[0] == ':') {
	if (fqname[0] == ':') {
		char *ns_name;
		char *ns_name;
		name = aa_split_fqname(fqname, &ns_name);
		name = aa_split_fqname(fqname, &ns_name);
		if (ns_name) {
		/* released below */
		/* released below */
		ns = aa_find_namespace(root, ns_name);
		ns = aa_find_namespace(root, ns_name);
		if (!ns) {
		if (!ns) {
@@ -1164,7 +1163,6 @@ ssize_t aa_remove_profiles(char *fqname, size_t size)
			error = -ENOENT;
			error = -ENOENT;
			goto fail;
			goto fail;
		}
		}
		}
	} else
	} else
		/* released below */
		/* released below */
		ns = aa_get_namespace(root);
		ns = aa_get_namespace(root);