public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
	Leif Lindholm <leif.lindholm@linaro.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	star.zeng@intel.com
Subject: Re: [PATCH v1 6/7] MdeModulePkg/UdfDxe: Remove dead codes in FileName.c
Date: Tue, 16 Oct 2018 15:46:04 +0800	[thread overview]
Message-ID: <9ff35864-15d9-aa86-f855-4d3dff83b700@intel.com> (raw)
In-Reply-To: <B80AF82E9BFB8E4FBD8C89DA810C6A093C82B15A@SHSMSX104.ccr.corp.intel.com>

Hao,

If these code removing will make the function to be not matched with its 
original implementation purpose according to the function description, 
and the description is not updated, the code's readability will be 
sacrificed. I prefer to keep the code's readability and follow the 
function's original implementation purpose.


Thanks,
Star

On 2018/10/16 14:28, Wu, Hao A wrote:
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Leif Lindholm
>> Sent: Tuesday, October 16, 2018 2:20 PM
>> To: Wu, Hao A
>> Cc: Ni, Ruiyu; edk2-devel@lists.01.org; Zeng, Star
>> Subject: Re: [edk2] [PATCH v1 6/7] MdeModulePkg/UdfDxe: Remove dead
>> codes in FileName.c
>>
>> On Mon, Oct 15, 2018 at 12:55:21PM +0800, Hao Wu wrote:
>>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1249
>>>
>>> We found potential dead codes within File.c during the code coverage test.
>>>
>>> After manual review, we think the below ones are positive reports:
>>>
>>> A. In function MangleFileName():
>>>
>>>    FileName = TrimString (FileName);
>>>    // Begin of dead codes
>>>    if (*FileName == L'\0') {
>>>      goto Exit;
>>>    }
>>>    // End of dead codes
>>>
>>> When the code reaches the TrimString() call, the string in 'FileName' is
>>> guaranteed to have a '\' character due to the call patterns of
>>
>> What in the call pattern guarantees this? Please be precise.
> 
> OK, I will update the log message.
> 
>>
>>> MangleFileName(). So after trimming the lead-off/tailing white spaces,
>>> string in 'FileName' will not be an empty string.
>>>
>>> B. In function MangleFileName():
>>>
>>>    if (FileName[0] == L'.') {
>>>      if (FileName[1] == L'.') {
>>>        if (FileName[2] == L'\0') {
>>>          goto Exit;
>>>        } else {
>>>          FileName += 2;
>>>        }
>>>      } else if (FileName[1] == L'\0') {
>>>        goto Exit;
>>>      }
>>>    }
>>>
>>> When the code hits the above checks, string in 'FileName' will always have
>>> a leading '\' character (denoting an absolute path) due to the call
>>> patterns of MangleFileName(). So no leading '.' can be there in string
>>> 'FileName'.
>>
>> What in the call pattern guarantees this? Please be precise.
> 
> OK, I will update the log message.
> 
> Thanks for the comments.
> 
> Best Regards,
> Hao Wu
> 
>>
>> Regards,
>>
>> Leif
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel



  reply	other threads:[~2018-10-16  7:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-15  4:55 [PATCH v1 0/7] Code refinements in UdfDxe Hao Wu
2018-10-15  4:55 ` [PATCH v1 1/7] MdeModulePkg/UdfDxe: Use error handling for memory allocation failure Hao Wu
2018-10-15  4:55 ` [PATCH v1 2/7] MdeModulePkg/UdfDxe: ASSERT for false positives of NULL ptr deref Hao Wu
2018-10-15  4:55 ` [PATCH v1 3/7] MdeModulePkg/UdfDxe: Use error handling when fail to return LSN Hao Wu
2018-10-15  4:55 ` [PATCH v1 4/7] MdeModulePkg/UdfDxe: Use debug msg instead of ASSERT in UdfOpen() Hao Wu
2018-10-15  4:55 ` [PATCH v1 5/7] MdeModulePkg/UdfDxe: Handle dead codes in File.c Hao Wu
2018-10-15  4:55 ` [PATCH v1 6/7] MdeModulePkg/UdfDxe: Remove dead codes in FileName.c Hao Wu
2018-10-16  6:20   ` Leif Lindholm
2018-10-16  6:28     ` Wu, Hao A
2018-10-16  7:46       ` Zeng, Star [this message]
2018-10-16  7:55         ` Wu, Hao A
2018-10-15  4:55 ` [PATCH v1 7/7] MdeModulePkg/UdfDxe: Handle dead codes in FileSystemOperations.c Hao Wu
2018-10-16  6:59   ` Zeng, Star
2018-10-16  7:50     ` Zeng, Star
2018-10-16  7:55       ` Wu, Hao A
2018-10-15 11:39 ` [PATCH v1 0/7] Code refinements in UdfDxe Paulo Alcantara
2018-10-16  6:20 ` Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ff35864-15d9-aa86-f855-4d3dff83b700@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox