Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1800267pxv; Fri, 16 Jul 2021 18:40:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYdci2xYagNRY49drWJtNAEr7atsZ61zhrh06V5LIst+93DVTlbtgzMeY1N9M1irP0ooK2 X-Received: by 2002:a02:628b:: with SMTP id d133mr11398768jac.27.1626486057646; Fri, 16 Jul 2021 18:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626486057; cv=none; d=google.com; s=arc-20160816; b=RoCm7NSFhPNGqIM852FqLwks1LDb1WIX3ct1FjRjJkdnL8/Dh9uBcvrpl6IxXB4cNh LeIbBhINbDF7dNwQu2BjHPZg94y3UlRlRJ3+j2CGXwv2lPMoJDdO5NP+GW/DSqwvx4Z4 UQwYqqYwrX8PCZjxcA+XqwNxkeqLM4VhjnKs8P7sMTFYp5XGVJn2WZkil8GVDHG47Zw1 79AFPvwyc2zrk+tafJMpwKvDQTKlrcY6qEvyokN6fZYlWYROz6Lm1CL1zLEcm2ulpOcW 02N6M4xK0CRwZjS/9YE2Vxwgybr/jXhAQWQVB7uo9xfakDUMyeg9zZYKFcAf6y0KQDfR 5lyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=z0LEeKFLAIVt4se1HF7bOD2bKeSB0rHLH7AYn9ZIHI4=; b=xgWNP1Gj7HCBdQLCsJBhQ5VyY5nDsUJPAE2zVS+nt04xlcoYvjzVK87nTUB3BMLeB5 aVv+BtJ04CMFeJiAB94QSiB2lKRAt63ckk2Nj2Y5MZhFU68vdJOQtbMvIuIQ/m9OF5m4 njTqZ0WoPSLLXY9bTrvhgm3gKJvpi1kjGPBQaBVu2LMsjS4fWn6A1kv7XTFmTnaCI2q5 Y8Au/5phMWldXmeKIsnF5hHMnHwQojOZeWgQ0gOidAr2fAVfOA5EYEGlTuuH+MCgS0K2 /slJqXnky9oOc16d+yrmL4bKEuIYiueGQvyupVRx4ecdPEc6ewC76X16n88VL7pgVuIk yvaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k12si12123865ilc.36.2021.07.16.18.40.27; Fri, 16 Jul 2021 18:40:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235303AbhGQBnN (ORCPT + 99 others); Fri, 16 Jul 2021 21:43:13 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:7380 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232277AbhGQBm5 (ORCPT ); Fri, 16 Jul 2021 21:42:57 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GRW0l6NH0z7v44; Sat, 17 Jul 2021 09:36:23 +0800 (CST) Received: from dggema765-chm.china.huawei.com (10.1.198.207) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Sat, 17 Jul 2021 09:39:59 +0800 Received: from [127.0.0.1] (10.174.177.249) by dggema765-chm.china.huawei.com (10.1.198.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Sat, 17 Jul 2021 09:39:59 +0800 Subject: Re: [PATCH v2 11/12] misc/lsattr: check whether path is NULL in lsattr_dir_proc() To: "Theodore Y. Ts'o" , wuguanghao CC: , , , References: <20210630082724.50838-2-wuguanghao3@huawei.com> <20210630082724.50838-12-wuguanghao3@huawei.com> From: Zhiqiang Liu Message-ID: <08a0c82a-9771-3b9e-04a8-4cede7d5d576@huawei.com> Date: Sat, 17 Jul 2021 09:39:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.174.177.249] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema765-chm.china.huawei.com (10.1.198.207) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2021/7/16 11:58, Theodore Y. Ts'o wrote: > On Wed, Jun 30, 2021 at 04:27:23PM +0800, wuguanghao wrote: >> diff --git a/misc/lsattr.c b/misc/lsattr.c >> index 0d954376..f3212069 100644 >> --- a/misc/lsattr.c >> +++ b/misc/lsattr.c >> @@ -144,6 +144,12 @@ static int lsattr_dir_proc (const char * dir_name, struct dirent * de, >> int dir_len = strlen(dir_name); >> >> path = malloc(dir_len + strlen (de->d_name) + 2); >> + if (!path) { >> + fprintf(stderr, "%s", >> + _("Couldn't allocate path variable " >> + "in lsattr_dir_proc")); >> + return -1; >> + } > The string is missing a closing newline. Also, why not? > > fputs(_("Couldn't allocate path variable in lsattr_dir_proc"), > stderr); > > - Ted > > . Thanks for your suggestion. We will resend the v3 patch as your suggestion.