[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YTcdbOgmB7758K+/@google.com>
Date: Tue, 7 Sep 2021 17:06:04 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Namjae Jeon <linkinjeon@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steve French <sfrench@...ba.org>,
Hyunchul Lee <hyc.lee@...il.com>, linux-cifs@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] ksmbd: remove unnecessary conditions
On (21/09/07 10:34), Dan Carpenter wrote:
>
> id = le32_to_cpu(psid->sub_auth[psid->num_subauth - 1]);
> - if (id >= 0) {
> - /*
> - * Translate raw sid into kuid in the server's user
> - * namespace.
> - */
> - uid = make_kuid(&init_user_ns, id);
> -
> - /* If this is an idmapped mount, apply the idmapping. */
> - uid = kuid_from_mnt(user_ns, uid);
> - if (uid_valid(uid)) {
> - fattr->cf_uid = uid;
> - rc = 0;
> - }
> + /*
> + * Translate raw sid into kuid in the server's user
> + * namespace.
> + */
> + uid = make_kuid(&init_user_ns, id);
Can make_kuid() return INVALID_UID? IOW, uid_valid(uid) here as well?
> +
> + /* If this is an idmapped mount, apply the idmapping. */
> + uid = kuid_from_mnt(user_ns, uid);
> + if (uid_valid(uid)) {
> + fattr->cf_uid = uid;
> + rc = 0;
> }
[..]
> + /*
> + * Translate raw sid into kgid in the server's user
> + * namespace.
> + */
> + gid = make_kgid(&init_user_ns, id);
Ditto.
> + /* If this is an idmapped mount, apply the idmapping. */
> + gid = kgid_from_mnt(user_ns, gid);
> + if (gid_valid(gid)) {
> + fattr->cf_gid = gid;
> + rc = 0;
Powered by blists - more mailing lists