Re: [PATCH] fs/cifs/cifsacl.c: remove set but not used variables 'rc'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Isn't this a different bug - we set rc to -EINVAL but then don't
return rc, we return 0 which looks wrong.

On Wed, Aug 21, 2019 at 11:11 PM zhengbin <zhengbin13@xxxxxxxxxx> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> fs/cifs/cifsacl.c: In function sid_to_id:
> fs/cifs/cifsacl.c:347:6: warning: variable rc set but not used [-Wunused-but-set-variable]
>
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Signed-off-by: zhengbin <zhengbin13@xxxxxxxxxx>
> ---
>  fs/cifs/cifsacl.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
> index 1d377b7..2b34337 100644
> --- a/fs/cifs/cifsacl.c
> +++ b/fs/cifs/cifsacl.c
> @@ -344,7 +344,6 @@ static int
>  sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
>                 struct cifs_fattr *fattr, uint sidtype)
>  {
> -       int rc;
>         struct key *sidkey;
>         char *sidstr;
>         const struct cred *saved_cred;
> @@ -405,7 +404,6 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
>         saved_cred = override_creds(root_cred);
>         sidkey = request_key(&cifs_idmap_key_type, sidstr, "");
>         if (IS_ERR(sidkey)) {
> -               rc = -EINVAL;
>                 cifs_dbg(FYI, "%s: Can't map SID %s to a %cid\n",
>                          __func__, sidstr, sidtype == SIDOWNER ? 'u' : 'g');
>                 goto out_revert_creds;
> @@ -418,7 +416,6 @@ sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
>          */
>         BUILD_BUG_ON(sizeof(uid_t) != sizeof(gid_t));
>         if (sidkey->datalen != sizeof(uid_t)) {
> -               rc = -EIO;
>                 cifs_dbg(FYI, "%s: Downcall contained malformed key (datalen=%hu)\n",
>                          __func__, sidkey->datalen);
>                 key_invalidate(sidkey);
> --
> 2.7.4
>


-- 
Thanks,

Steve



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux