[PATCH 1/3] apparmor: Fix return in ns_mkdir_op

John Johansen john.johansen at canonical.com
Sat Jun 13 07:13:08 UTC 2026


On 5/2/26 21:12, Hongling Zeng wrote:
> Return NULL instead of passing to ERR_PTR while error is zero.
>    Fixes smatch warning:
>      - security/apparmor/apparmorfs.c:1846 ns_mkdir_op() warn:
>        passing zero to 'ERR_PTR'
> 
> Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
> Signed-off-by: Hongling Zeng <zenghongling at kylinos.cn>

Acked-by: John Johansen <john.johansen at canonical.com>

this has been pulled in to my tree

> ---
>   security/apparmor/apparmorfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
> index ededaf46f3ca..1d7b1c70f22a 100644
> --- a/security/apparmor/apparmorfs.c
> +++ b/security/apparmor/apparmorfs.c
> @@ -1922,7 +1922,7 @@ static struct dentry *ns_mkdir_op(struct mnt_idmap *idmap, struct inode *dir,
>   	mutex_unlock(&parent->lock);
>   	aa_put_ns(parent);
>   
> -	return ERR_PTR(error);
> +	return error ? ERR_PTR(error) : NULL;
>   }
>   
>   static int ns_rmdir_op(struct inode *dir, struct dentry *dentry)




More information about the Linux-security-module-archive mailing list