From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=ctqVIFOf; spf=pass (domain: gmx.de, ip: 212.227.17.20, mailfrom: xypron.glpk@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by groups.io with SMTP; Tue, 09 Apr 2019 09:37:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1554827829; bh=DunDw1AVE3kRAmkvaq5Hvitpy9o0aFxFZ0KpZQdB0So=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=ctqVIFOf8oh6m3AuS7iqJRUJwC0yiQ4kN8kFbSSRS1UZegpIc3J3eZU620seYqqSz H9p+fq/pcaKxVPZsTX+JbBu/jRUGIe8JHWiDXzESPBzJFlZXcPaMBf1tULLH0AWQIm 5PCUZROhoR9BJm2qDsj5ssFdX88cqOukVJ2HatNY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.60] ([84.118.159.3]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MGWR2-1h9Y963slE-00DGMD; Tue, 09 Apr 2019 18:37:09 +0200 Subject: Re: [edk2-devel] [PATCH 1/1] ShellPkg/CommandLib: avoid NULL derefence and memory leak To: "Gao, Zhichao" , "devel@edk2.groups.io" , "Carsey, Jaben" , "Ni, Ray" , Leif Lindholm Cc: "Gao, Liming" References: <20190405012903.20796-1-xypron.glpk@gmx.de> <3CE959C139B4C44DBEA1810E3AA6F9000B7C0E98@SHSMSX101.ccr.corp.intel.com> From: "Heinrich Schuchardt" Openpgp: preference=signencrypt Autocrypt: addr=xypron.glpk@gmx.de; prefer-encrypt=mutual; keydata= mQINBE2g3goBEACaikqtClH8OarLlauqv9d9CPndgghjEmi3vvPZJi4jvgrhmIUKwl7q79wG IATxJ1UOXIGgriwoBwoHdooOK33QNy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Egdu8LAUaxIkbD/wMTA8n8wgthSkPvhTeL13cO5/C3/EbejQU IJOS68I2stnC1ty1FyXwAygixxt3GE+3BlBVNN61dVS9SA498iO0ApxPsy4Q7vvQsF7DuJsC PdZzP/LZRySUMif3qAmIvom8fkq/BnyHhfyZ4XOl1HMr8pMIf6/eCBdgIvxfdOz79BeBBJzr qFlNpxVP8xrHiEjZxU965sNtDSD/1/9w82Wn3VkVisNP2MpUhowyHqdeOv2uoG6sUftmkXZ8 RMo+PY/iEIFjNXw1ufHDLRaHihWLkXW3+bS7agEkXo0T3u1qlFTI6xn8maR9Z0eUAjxtO6qV lGF58XeVhfunbQH8Kn+UlWgqcMJwBYgM69c65Dp2RCV7Tql+vMsuk4MT65+Lwm88Adnn6ppQ S2YmNgDtlNem1Sx3JgCvjq1NowW7q3B+28Onyy2fF0Xq6Kyjx7msPj3XtDZQnhknBwA7mqSZ DDw0aNy1mlCv6KmJBRENfOIZBFUqXCtODPvO5TcduJV/5XuxbTR/33Zj7ez2uZkOEuTs/pPN oKMATC28qfg0qM59YjDrrkdXi/+iDe7qCX93XxdIxpA5YM/ZiqgwziJX8ZOKV7UDV+Ph5KwF lTPJMPdQZYXDOt5DjG5l5j0cQWqE05QtYR/V6g8un6V2PqOs9WzaT/RB12YFcaeWlusa8Iqs Eg== Message-ID: <30091abc-66a8-f110-442b-0b7cab347a54@gmx.de> Date: Tue, 9 Apr 2019 18:37:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <3CE959C139B4C44DBEA1810E3AA6F9000B7C0E98@SHSMSX101.ccr.corp.intel.com> X-Provags-ID: V03:K1:C5FDAMPXKegvpnI0q01U+d18XyPBNXn5bejhGNtmrvr0mOeHvWD 8qfxNNAZFkJajuU86hKnL+fU8Z1Bi01ec6SxHGZOMe7LvlW8jGTsqoArAAi/1zmJFp0qrdJ 1WXtgHtigS3c/thuKcXv2YRj5A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nwOotfYaQjt+Vbw1l X-Groupsio-MsgNum: 38742 Content-Type: multipart/mixed; boundary="------------2DE28AF041CFE7D5F24216FD" Content-Language: en-US --------------2DE28AF041CFE7D5F24216FD Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/9/19 7:33 AM, Gao, Zhichao wrote: > The patch code looks good to me. > But while I apply this patch, it will shows "error: corrupt patch at lin= e 24" and " error: could not build fake ancestor". Maybe you direct change= the patch file and remove some blank lines. > For Uefi BdsDxe driver, the variable "PlatfomLang" would be initialize a= ll the time. But maybe other manufacturers may have their own Bds solution= and do not set this variable. This patch makes the Shell app more compati= ble. > > Without the patch warning. > Reviewed-by: Zhichao Gao Hello Zhichao, I am not able to reproduce the problem. I resend you the patch as attachment. When applying I had to use --keep-cr: git am --keep-cr \ ../patch/0001-ShellPkg-CommandLib-avoid-NULL-derefence-and-memory-.patch I have found no way neither on Windows nor on Linux to create a patch that applies without --keep-cr. If you still have a problem, please, send me your global and local gitconfig files, your .gitattributes and indicate on which operating system you are working with which git version. Best regards Heinrich --------------2DE28AF041CFE7D5F24216FD Content-Type: text/x-diff; name="0001-ShellPkg-CommandLib-avoid-NULL-derefence-and-memory-.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-ShellPkg-CommandLib-avoid-NULL-derefence-and-memory-.pa"; filename*1="tch" RnJvbSA5NDc4YmJjZDFkOGEwMzc2MjkyNGEwYjQ1MzNjMWI4NGNiZmNhYTU3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBIZWlucmljaCBTY2h1Y2hhcmR0IDx4eXByb24uZ2xwa0BnbXgu ZGU+CkRhdGU6IEZyaSwgNSBBcHIgMjAxOSAwMzowNjoxOCArMDIwMApTdWJqZWN0OiBbUEFUQ0gg MS8xXSBTaGVsbFBrZy9Db21tYW5kTGliOiBhdm9pZCBOVUxMIGRlcmVmZW5jZSBhbmQgbWVtb3J5 IGxlYWsKClNpbmNlIFRpYW5vQ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Y29kZUNvbGxhdGlvbjJQcm90b2NvbEd1aWQs DQpAQCAtMTEzLDYgKzExMSwxNCBAQCBDb21tYW5kSW5pdCgKICAgICAgICAgY29udGludWU7DQog ICAgICAgfQ0KIA0KKyAgICAgIC8vDQorICAgICAgLy8gV2l0aG91dCBjbHVlIHByb3ZpZGVkIHVz ZSB0aGUgZmlyc3QgVW5pY29kZSBDb2xsYXRpb24yIHByb3RvY29sLg0KKyAgICAgIC8vDQorICAg ICAgaWYgKFBsYXRmb3JtTGFuZyA9PSBOVUxMKSB7DQorICAgICAgICBnVW5pY29kZUNvbGxhdGlv biA9IFVjOw0KKyAgICAgICAgYnJlYWs7DQorICAgICAgfQ0KKw0KICAgICAgIC8vDQogICAgICAg Ly8gRmluZCB0aGUgYmVzdCBtYXRjaGluZyBtYXRjaGluZyBsYW5ndWFnZSBmcm9tIHRoZSBzdXBw b3J0ZWQgbGFuZ3VhZ2VzDQogICAgICAgLy8gb2YgVW5pY29kZSBDb2xsYXRpb24yIHByb3RvY29s Lg0KQEAgLTEzMiw3ICsxMzgsOSBAQCBDb21tYW5kSW5pdCgKICAgICBpZiAoSGFuZGxlcyAhPSBO VUxMKSB7DQogICAgICAgRnJlZVBvb2wgKEhhbmRsZXMpOw0KICAgICB9DQotICAgIEZyZWVQb29s IChQbGF0Zm9ybUxhbmcpOw0KKyAgICBpZiAoUGxhdGZvcm1MYW5nICE9IE5VTEwpIHsNCisgICAg ICBGcmVlUG9vbCAoUGxhdGZvcm1MYW5nKTsNCisgICAgfQ0KICAgfQ0KIA0KICAgcmV0dXJuIChn VW5pY29kZUNvbGxhdGlvbiA9PSBOVUxMKSA/IEVGSV9VTlNVUFBPUlRFRCA6IEVGSV9TVUNDRVNT Ow0KLS0gCjIuMjAuMQoK --------------2DE28AF041CFE7D5F24216FD--