public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: Star Zeng <star.zeng@intel.com>, devel@edk2.groups.io
Cc: Eric Dong <eric.dong@intel.com>, Ray Ni <ray.ni@intel.com>
Subject: Re: [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Use %08x to print CacheControl Index
Date: Mon, 3 Feb 2020 09:46:40 +0100	[thread overview]
Message-ID: <3bf7a886-205b-957b-6573-9fa6f04c169e@redhat.com> (raw)
In-Reply-To: <20200203070631.14332-1-star.zeng@intel.com>

Hello Star,

On 02/03/20 08:06, Star Zeng wrote:
> Instead of %08lx, use %08x to print CacheControl Index
> as it is UINT32 type.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  .../Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c      | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> index 0a4fcff033a3..1a02809b0e7c 100644
> --- a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> @@ -465,7 +465,7 @@ DumpRegisterTableOnProcessor (
>      case CacheControl:
>        DEBUG ((
>          DebugPrintErrorLevel,
> -        "Processor: %04d: Index %04d, CACHE: %08lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
> +        "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
>          ProcessorNumber,
>          FeatureIndex,
>          RegisterTableEntry->Index,
> 

if you are already touching this DEBUG invocation, can you please fix
the rest of the issues with the format string?

- ProcessorNumber is UINTN. If we know for sure it can be represented in
a UINT32, then it should be cast to UINT32 explicitly, and logged with
"%04u". (Otherwise, UINTN needs to be cast to UINT64, and logged with
%lu or %lx.)

- Ditto for FeatureIndex.

The rest of the format specifications (including the now-fixed
CPU_REGISTER_TABLE_ENTRY.Index) are OK.

Thanks
Laszlo


  reply	other threads:[~2020-02-03  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-03  7:06 [PATCH] UefiCpuPkg RegisterCpuFeaturesLib: Use %08x to print CacheControl Index Zeng, Star
2020-02-03  8:46 ` Laszlo Ersek [this message]
2020-02-03  9:09   ` Zeng, Star
2020-02-03 13:22     ` Laszlo Ersek
2020-02-04  7:04       ` 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=3bf7a886-205b-957b-6573-9fa6f04c169e@redhat.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