Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3956566pxj; Mon, 24 May 2021 19:47:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1zmMo0jk7RDrfz+2qB9L0sSTFNW7icPX85HTolr2OY0s85RUld9UR6OU94Rpe6e1/7N7M X-Received: by 2002:a92:c24b:: with SMTP id k11mr16578314ilo.303.1621910874456; Mon, 24 May 2021 19:47:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621910874; cv=none; d=google.com; s=arc-20160816; b=ZSZnJxR51W9YJ2UgunAsOHO2gB4c3LSeWuymiuk0RHlE68lBCKfSQX/gYRozR7NE0E J6CQHmGM2Xb2XEwJy3ssegFhYGWTHoYQ398YdUH3Rqch8x5cevipCs1epbpAiZqsVZKu k/uK3e56MPVOvxrymuMUYqp2pkfKaRM9jzphDJcj7mlm/YBA3GuSekdkYjQMqbNtCySz MRuwwfOnhhdLOriyLIj6IofvtGm3LGfF9kmfrT/5kqdZ4KSxA0tRPjY0z5m1xACNk7ta 4RrINMEqR0f3zFm+bpEXBys1AHoObsdX/C8v0Y5FpTI1a+Sh0GUolILEclT9xffAYAUg sGvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:references:cc:to:from :subject; bh=bfp/QpVB2N2+72s8Z3L/Uc6/bXMX9hn+8SVoy05V4h4=; b=Nl+7NOmqzACz80wjCZJG/mrrxBXuf7rXPfxO5NF4vrTwh89q0KIUsrJY017mFwqd8c qtARidIyr3MBD4v0NVNBWatLNiloj5QXAgZJfvPu4yGNDjXKRgPcvLpMNtq15Ae7L/cF T7J6ub0DgxA5nOGFGM2O8TIOi/wRHbCM8hVZefSwdQpB3nrjucQxjfmcmHfROIHr8WGU QF6JlUsvoiWaVdz6unaRNKnwqZJNiLDPNZSetR6Iwq4DRw3F9pxPlDuKpEyuA8VXxEyL Sr8vsXEk3FAEn+nJqT8QTMWG0vbLSDZfqkAQGPY5+rkEG+WiIGb+Si5MxkHe/+ON9WPl UEOA== 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 l11si17120733jak.61.2021.05.24.19.47.32; Mon, 24 May 2021 19:47:54 -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 S230091AbhEYCdz (ORCPT + 99 others); Mon, 24 May 2021 22:33:55 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:3990 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbhEYCdz (ORCPT ); Mon, 24 May 2021 22:33:55 -0400 Received: from dggems701-chm.china.huawei.com (unknown [172.30.72.60]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Fpyj91xXVzmZtc for ; Tue, 25 May 2021 10:30:05 +0800 (CST) Received: from dggpemm500014.china.huawei.com (7.185.36.153) by dggems701-chm.china.huawei.com (10.3.19.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 10:32:25 +0800 Received: from [10.174.179.184] (10.174.179.184) by dggpemm500014.china.huawei.com (7.185.36.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 25 May 2021 10:32:24 +0800 Subject: Re: [PATCH 07/12] argv_parse: check return value of malloc in argv_parse() From: Wu Guanghao To: CC: , References: <266bc52e-e279-ce84-0e1f-1405b9bc6174@huawei.com> <5d711bbc-50bb-c8a5-a118-e22a691c0d7f@huawei.com> Message-ID: Date: Tue, 25 May 2021 10:32:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.1 MIME-Version: 1.0 In-Reply-To: <5d711bbc-50bb-c8a5-a118-e22a691c0d7f@huawei.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.184] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500014.china.huawei.com (7.185.36.153) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org There is a problem with this patch. "argv" is spelled as "arcv". This problem will be resolved in the v2 version. ?? 2021/5/24 19:23, Wu Guanghao ะด??: > In argv_parse(), return value of malloc should be checked > whether it is NULL, otherwise, it may cause a segfault error. > > Signed-off-by: Zhiqiang Liu > Signed-off-by: Wu Guanghao > --- > lib/support/argv_parse.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/support/argv_parse.c b/lib/support/argv_parse.c > index d22f6344..1ef9c014 100644 > --- a/lib/support/argv_parse.c > +++ b/lib/support/argv_parse.c > @@ -116,6 +116,8 @@ int argv_parse(char *in_buf, int *ret_argc, char ***ret_argv) > if (argv == 0) { > argv = malloc(sizeof(char *)); > free(buf); > + if (!arcv) > + return -1; > } > argv[argc] = 0; > if (ret_argc) >