Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp219516rwe; Wed, 31 Aug 2022 20:19:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR51IR6p+YGWBI4zR9aY72ZBF2+kuuHg8WIAGEl9nbYU5zqO+hn6ma08jqJNnUsmc1LFge5P X-Received: by 2002:a17:90b:4aca:b0:1fe:686:fbf3 with SMTP id mh10-20020a17090b4aca00b001fe0686fbf3mr6419962pjb.174.1662002397705; Wed, 31 Aug 2022 20:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662002397; cv=none; d=google.com; s=arc-20160816; b=0nbqkyonakrAxyQIfbFGOf4adOgzooMwkZPSv5jywdCYOeYbDxEzOZhFQ5K9y+05My GEEqXbZ23fzaE7jM8N2s7kJUn+F1x/hOjglr+7dZprijzIkY85WWsDjhhi24pV/8QjiM ZAsp1ePiUbSpa2EpYbMltpx2fxUK95TpmemqixdsVzd+zMNVO31kTmeo1PTQycNeVdRa PpJSAj/82R1p61cIdtI6V/So0sjce0g/016m23XCxaqCBd6wOJXAvW18z+l38U38Q+O4 B0sdbWyNiLjbYyNleBxnv8nvzAm57/6p04fdFmbh6iDGbSR5006KOTM3WrneTlRtA5UK 2CBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:subject:from:cc:to; bh=46IzIzc6bp8VQzwgQQem6I2B7xfhfclYsCasq2ev26c=; b=Qe0pmL6nsGE51osKjOWuiNnodEFk2ESGE7Dw1fmfufrV83JFiZXfHsg13egtTQZRgB Zq5Rgm808MubSRlEH5g17QcWhPiW3F0t0ZmSd07cr1QRVskCo1iFBVyFTjR1vb2k48Gh aXAFZI52sYlgCYZU9baVLOeydvpqGpB4bjsOUuttnHLGU/EmG4tSIqd4+07HWjBlW3c7 zU0m42LjAsbrA9r0QWJhM7Jvo7PEeyvhXJFlCFgchFNcF62j6ihx10GQSRFYhHHIV9oA bgdF/mN0JWAGSJEGKAwGaAKN7Pf6y3yT2T3wVWY/UgfYwfoZQ5FLbLLew32zKUhFPm/2 1aGQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w69-20020a638248000000b0041d131d71e9si6603686pgd.827.2022.08.31.20.19.40; Wed, 31 Aug 2022 20:19:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232179AbiIAC7b (ORCPT + 99 others); Wed, 31 Aug 2022 22:59:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232658AbiIAC7R (ORCPT ); Wed, 31 Aug 2022 22:59:17 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A43A2161DF3; Wed, 31 Aug 2022 19:59:13 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MJ5Jd716czlWft; Thu, 1 Sep 2022 10:55:45 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 1 Sep 2022 10:59:11 +0800 Received: from [127.0.0.1] (10.174.177.249) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 1 Sep 2022 10:59:10 +0800 To: , , CC: linfeilong , wuguanghao , From: Zhiqiang Liu Subject: [PATCH v2] xfs: donot need to check return value of xlog_kvmalloc() Message-ID: <471db2ec-8836-14f5-fb33-579b294943e9@huawei.com> Date: Thu, 1 Sep 2022 10:59:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.249] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 In xfs_attri_log_nameval_alloc(), xlog_kvmalloc() is called to alloc memory, which will always return successfully, so we donot need to check return value. Reviewed-by: Eric Sandeen Signed-off-by: Zhiqiang Liu --- Changelog: V1 -> V2: 1.add Reviewed-by: Eric Sandeen 2.remove santity check of xfs_attri_log_nameval_alloc() suggested by Eric Sandeen. fs/xfs/xfs_attr_item.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c index 5077a7ad5646..cf5ce607dc05 100644 --- a/fs/xfs/xfs_attr_item.c +++ b/fs/xfs/xfs_attr_item.c @@ -86,8 +86,6 @@ xfs_attri_log_nameval_alloc( */ nv = xlog_kvmalloc(sizeof(struct xfs_attri_log_nameval) + name_len + value_len); - if (!nv) - return nv; nv->name.i_addr = nv + 1; nv->name.i_len = name_len; @@ -441,8 +439,6 @@ xfs_attr_create_intent( attr->xattri_nameval = xfs_attri_log_nameval_alloc(args->name, args->namelen, args->value, args->valuelen); } - if (!attr->xattri_nameval) - return ERR_PTR(-ENOMEM); attrip = xfs_attri_init(mp, attr->xattri_nameval); xfs_trans_add_item(tp, &attrip->attri_item); @@ -762,8 +758,6 @@ xlog_recover_attri_commit_pass2( nv = xfs_attri_log_nameval_alloc(attr_name, attri_formatp->alfi_name_len, attr_value, attri_formatp->alfi_value_len); - if (!nv) - return -ENOMEM; attrip = xfs_attri_init(mp, nv); error = xfs_attri_copy_format(&item->ri_buf[0], &attrip->attri_format); -- 2.33.0