From patchwork Thu Sep 28 18:07:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak R Varma X-Patchwork-Id: 146263 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3537287vqu; Thu, 28 Sep 2023 12:09:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxqKMGxPW2aZn9DX/OAmIjZdwrMx0zaC6iplXoMmkL/nyXcwaIM37CBjenkqbX4V12NlMu X-Received: by 2002:a05:6a21:186:b0:12e:5f07:7ede with SMTP id le6-20020a056a21018600b0012e5f077edemr2465229pzb.41.1695928195321; Thu, 28 Sep 2023 12:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695928195; cv=none; d=google.com; s=arc-20160816; b=yPdNs3xh9Mm3vdd6T+vYwSmdV5hEeDjg7D92JZJa3BzCP4J1wOWh8fuTSHPXlrB+Zk 5AKcx5Z7/Ww6k96Ya07wS/ILRau5OzzL1FrtTeC1VkgRp7BpFffRfvGFVoliqm+/OT+4 A+vMSqqeoOwlCMiU3L/wTV0aDYvX9MAp3p4ifKZd4/3J3Xo6aDyMb981okC4+u+4tfCJ wtf+hCwgHVQyIAyCrc9Zo14RLcAATVNP5ywg1IH+xjFNx00Ab/ooAkHEDySeuM/r3KOy lQlKFUvPs01EEMZ6vc7u1uMo6S3dGZUTzTgp6/adb32VLXlhCpA2F4gT+GBjtDydEDpR xc9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=PswdDGgrXtc0FzFqWrPMGVHmqVS1VoksfTXfXyvzM6w=; fh=YygLGKUlh4nHQ5Rdr9ftF/ryVinr9z2zBS9B5G9J/50=; b=nzxB75Q/OYB+d3iwcljKHiIgge1gSiJ3muXIDkxIi0CG3AolRfCryukDwKudZzZmk1 tRJjutFksnFRJucH0tOuWrcc9Ex441B25P9YsrGDQU51fi3vUKXHrpWBh++NRmxhA+Sw f/LHvExeKsypKscmHgdl9Ve95L9CCXsY6DNK3Mpyeq2O/AWwWJ7qglSZTh6GrFDrM2ge Q9a2gIPK8GSSNuUQR/810vbFktRp6MdlOKplaOi0Ot4KEGtI2zV7ckY8Ft14TxyHqVdE 1K5il2aYU1NpS2BfiSRFRkzR+h1esRdeMeOnnODqDVwHLMjqKMcVCyV1xkDyzl1WPwhE 4j9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=aZBjYWK8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id fa20-20020a056a002d1400b006935df301a3si1171705pfb.8.2023.09.28.12.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 12:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=fail header.i=@mailo.com header.s=mailo header.b=aZBjYWK8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mailo.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7D2CA8582FDB; Thu, 28 Sep 2023 11:08:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbjI1SII (ORCPT + 21 others); Thu, 28 Sep 2023 14:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbjI1SIF (ORCPT ); Thu, 28 Sep 2023 14:08:05 -0400 Received: from mailo.com (msg-1.mailo.com [213.182.54.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2A471AD for ; Thu, 28 Sep 2023 11:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=mailo.com; s=mailo; t=1695924469; bh=oObhWCm0aLg4S+GS1V9cLf/a75Slux1PBQAsLF5Xpos=; h=X-EA-Auth:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type; b=aZBjYWK8O+r3GWmOXTHMtUrkjxMO+/JCA8mNVlu7TgNgO6LmdC3AGLP0uGiHtMb0S KiMttSmBr7ArfkieuKhF5NHDmlblmtpxS/8XJ0IkRQNqncCeleuqfmOlWsoSeAvrEp wgX8oN5MjA+TWCVMwRqsizlNSy5sQSgVT40HF++I= Received: by b221-4.in.mailobj.net [192.168.90.24] with ESMTP via ip-20.mailobj.net [213.182.54.20] Thu, 28 Sep 2023 20:07:49 +0200 (CEST) X-EA-Auth: UsKampcKnXwLSvLdP7O8yhzEp/Ut96KaB06/sLcfF/h3F5XRvLbqg4ykuLZZ66CGW17C8kGlVgTOtG97uwG4MyxA39usmocW Date: Thu, 28 Sep 2023 23:37:42 +0530 From: Deepak R Varma To: Bob Peterson , Andreas Gruenbacher , gfs2@lists.linux.dev, linux-kernel@vger.kernel.org Cc: linux-kernel-mentees@lists.linuxfoundation.org, Dan Carpenter , Deepak R Varma Subject: [PATCH] gfs2: fix 'passing zero to ERR_PTR()' warning Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 11:08:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778309603188183013 X-GMAIL-MSGID: 1778309603188183013 Resolve the following Smatch static checker warning: fs/gfs2/acl.c:54 __gfs2_get_acl() warn: passing zero to 'ERR_PTR' by returning NULL when an extended attribute length is zero, instead of passing on zero to the ERR_PTR(). Signed-off-by: Deepak R Varma --- Please note: Patch is build tested only. fs/gfs2/acl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.39.2 diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c index 443640e6fb9c..818d67f10dcf 100644 --- a/fs/gfs2/acl.c +++ b/fs/gfs2/acl.c @@ -50,8 +50,11 @@ static struct posix_acl *__gfs2_get_acl(struct inode *inode, int type) name = gfs2_acl_name(type); len = gfs2_xattr_acl_get(ip, name, &data); - if (len <= 0) + if (len == 0) + return NULL; + if (len < 0) return ERR_PTR(len); + acl = posix_acl_from_xattr(&init_user_ns, data, len); kfree(data); return acl;