Skip to content

Commit bc4d82f

Browse files
committed
apparmor: fix incorrect type assignment when freeing proxies
sparse reports poisoning the proxy->label before freeing the struct is resulting in a sparse build warning. ../security/apparmor/label.c:52:30: warning: incorrect type in assignment (different address spaces) ../security/apparmor/label.c:52:30: expected struct aa_label [noderef] <asn:4>*label ../security/apparmor/label.c:52:30: got struct aa_label *<noident> fix with RCU_INIT_POINTER as this is one of those cases where rcu_assign_pointer() is not needed. Signed-off-by: John Johansen <[email protected]>
1 parent 15372b9 commit bc4d82f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/apparmor/label.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ static void free_proxy(struct aa_proxy *proxy)
4949
/* p->label will not updated any more as p is dead */
5050
aa_put_label(rcu_dereference_protected(proxy->label, true));
5151
memset(proxy, 0, sizeof(*proxy));
52-
proxy->label = (struct aa_label *) PROXY_POISON;
52+
RCU_INIT_POINTER(proxy->label, (struct aa_label *)PROXY_POISON);
5353
kfree(proxy);
5454
}
5555
}

0 commit comments

Comments
 (0)