Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3895145ybf; Tue, 3 Mar 2020 15:14:21 -0800 (PST) X-Google-Smtp-Source: ADFU+vuG4ob8fbO0vsNcwxkjTWIecj1fojJQqJu364Ds3Gpr47AfjF7d3iWb57oN02DLkJ8WSQe2 X-Received: by 2002:a9d:554a:: with SMTP id h10mr192859oti.344.1583277261678; Tue, 03 Mar 2020 15:14:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583277261; cv=none; d=google.com; s=arc-20160816; b=mjdzKS2UD/MVZBisBTMoFqFp8xiU7cb9Iv4jyMVWCyI/MSKK66Z4Y8R/R6GzJli/M0 JqkSrOfjHzLVbZ055hH1z16WFpuAkC87YRA4qmtqQsZDbmUfiLacd9uOpqlQLon1d3Ek St6Jv+tpGduC/gNLgOd2A3n4ioLMlEpznTczR00swEvyyHCgRB/gDaTq+QQEKpD9RhdA 7wZqp4KvDY2NCRcnn2Vf5J/Wql1VISL16xd2sRNh0Zvk/rBM0zlWvk/l9RTsj+w2ZNWn hyU2GaJ0Xzkpyd+OY6apjVk1GUHfhenNOQ2wJHRfNLxhz+Zv+Isd2vSAQJ1GojQShGHu meyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=vJr9ys90m3qSyzdRvYFeDv9aPSWThVfEBslU4+ThXWc=; b=fbhPrDaKgzEXTwRFkUHuFG5L9JwheBhisZwkpWIjwE2z6+6ojSKhx03UcTxJc60y02 rB+nVH+f4z1+e/F6HvU/J0n4APttuTd5bdgCQ8ur3WLZKgfxBGFl5xS4Pi9GKWdSO12j MDxmU6vuph8P5SQ4boicmP8sHroshj7DZzi/oPkRcg1+V9fEQUQnMdhUlJdyeYrpfkrv cB+UVAmZOgA88ZDSWZJdiCAibXAxODKV/OzVamO5VJwZJMP5ZFXQKDWN79gXaV2pMk0i ocVF6KDZwQTyteKo+YjvoBCW+tp6QGZDOzPVwhOZM5Bu+2Bw7y5c3iHcSyn3ykQBdaZZ OjKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sFDL1Os+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si40435oth.247.2020.03.03.15.14.09; Tue, 03 Mar 2020 15:14:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sFDL1Os+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbgCCXNj (ORCPT + 99 others); Tue, 3 Mar 2020 18:13:39 -0500 Received: from mail-il1-f193.google.com ([209.85.166.193]:45402 "EHLO mail-il1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727199AbgCCXNi (ORCPT ); Tue, 3 Mar 2020 18:13:38 -0500 Received: by mail-il1-f193.google.com with SMTP id p8so154140iln.12; Tue, 03 Mar 2020 15:13:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vJr9ys90m3qSyzdRvYFeDv9aPSWThVfEBslU4+ThXWc=; b=sFDL1Os+uBZQJw2DKQ45Pscc95zk/o7Pif1zFFOBmxFHXvfyeAzrsTPB4xr5psDlQD bo0h/xAmnf1Vn1ScoDL+Rhjb/l0hYfysV1tc/vpKJ9EeAGV1CFaWPrG9D+a47ZwMy7FA EYCIUAovLySxlND1MNLDCVZdtQSGs0YAo9jkBWxduyeWBp63A19cioCnhkIMn3JsaKuT k4mjYsDiAYeHQXGFxRpiK5WevUk0QKLgYoAQrXayG1B0ySJ9iw4rQC/9TNjm7jeI92ZK 6unXM7Xs6KGGCiiZwLY7LCta22CMqbdyMCHda7byprmPTFrecITvRyAlMkSgL6tnoJhY g+wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vJr9ys90m3qSyzdRvYFeDv9aPSWThVfEBslU4+ThXWc=; b=TR5F4R5KrxrqnuB+YsMYcBgUVqHaiYysJL02+vv6HBrXYNQ4FDlM+tlN+SuqWYbpRF xRoinnibt2n6xdMLdWYms5iKIxJgT8YSXDVxdkOJBME9eH4fx8MyNznn1Gie8kohXGg7 VUXq2h6mIYt2KvBTkYqF2/qvUZUjjX+94oNPPcacdXx13SjZMd0Fa3JSRJGm89IRUOPs +p5Qd8DgfxzSgKW3DAXMAeFZq3TI3Lcn2jjvuqGNCwD8zXlIthLnaSRejdtHls92oxzb /6zF/7SblQ121wWEMaYeQXpioNu6uBNlKFZB7mHC3AuNYlKW38HBPZwe36FSWAHW84lD J6Zw== X-Gm-Message-State: ANhLgQ2thvEpDu/bn0HYgnG+SfNhnQdsrXU/OamZW+wBP2aHNarqbq7P OckIjiyqo874ARkqI9VbCzwH6sQ+EyucQLV2YcM= X-Received: by 2002:a92:ce02:: with SMTP id b2mr98748ilo.70.1583277218119; Tue, 03 Mar 2020 15:13:38 -0800 (PST) MIME-Version: 1.0 References: <1583250197-10786-1-git-send-email-hqjagain@gmail.com> In-Reply-To: From: Qiujun Huang Date: Wed, 4 Mar 2020 07:13:27 +0800 Message-ID: Subject: Re: [PATCH] fs/cifs/cifsacl: fix sid_to_id To: Steve French Cc: Steve French , CIFS , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 4, 2020 at 4:13 AM Steve French wrote: > > Doesn't rc = 0 have to be set earlier (preferably in the declaration > on line 345)? > > since line 392 does > goto got_valid_id; > which appears to leave rc unitialized with your change > ok, I noticed that fall back to using the mnt_uid/mnt_gid. Should we remove the variable 'rc'. It is set but not used. And I was confused last time. (: diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 716574a..1cf3916 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c @@ -342,7 +342,6 @@ 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; @@ -403,7 +402,6 @@ 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; @@ -416,7 +414,6 @@ */ 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);