public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dandan Bi" <dandan.bi@intel.com>
To: Jeff Brasen <jbrasen@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
Date: Wed, 24 Jun 2020 01:36:24 +0000	[thread overview]
Message-ID: <BN6PR11MB1393036C52F9E02331265959EA950@BN6PR11MB1393.namprd11.prod.outlook.com> (raw)
In-Reply-To: <a356cbfb333734167bbbdc76821ab03bcd0530e6.1592849899.git.jbrasen@nvidia.com>

Reviewed-by: Dandan Bi <dandan.bi@intel.com>



Thanks,
Dandan
> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Tuesday, June 23, 2020 2:20 AM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Bi, Dandan <dandan.bi@intel.com>;
> Jeff Brasen <jbrasen@nvidia.com>
> Subject: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to
> UnicodeStrnToAsciiStrS
> 
> UnicodeStrToAsciiStrS requires that the source string is shorter than the
> destination buffer and will ASSERT if this is not true. Switch to
> UnicodeStrnToAsciiStrS as there are cases where the source string is longer
> than the buffer allocated for the device path.
> 
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
>  .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c     | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> index f500e20b32..d378c59dd9 100644
> ---
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> +++
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> @@ -837,7 +837,7 @@ GetDeviceInfoFromHandleAndUpdateLength (
>        ControllerNameStringSize = FPDT_MAX_PERF_RECORD_SIZE - (*Length) -
> 1;
>      }
> 
> -    UnicodeStrToAsciiStrS(StringPtr, ComponentNameString,
> ControllerNameStringSize);
> +    UnicodeStrnToAsciiStrS(StringPtr, ControllerNameStringSize - 1,
> + ComponentNameString, ControllerNameStringSize,
> + &ControllerNameStringSize);
> 
>      //
>      // Add a space in the end of the ControllerName @@ -879,7 +879,7 @@
> GetDeviceInfoFromHandleAndUpdateLength (
>          AsciiStringPtr = ComponentNameString;
>        }
> 
> -      UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize);
> +      UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1,
> + AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize);
>        *Length += (UINT8)DevicePathStringSize;
>        return EFI_SUCCESS;
>      }
> --
> 2.17.1


  reply	other threads:[~2020-06-24  1:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 18:20 [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Jeff Brasen
2020-06-24  1:36 ` Dandan Bi [this message]
2020-07-17 20:46   ` Jeff Brasen
2020-07-20  1:15     ` Dandan Bi

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=BN6PR11MB1393036C52F9E02331265959EA950@BN6PR11MB1393.namprd11.prod.outlook.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