public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>
Subject: Re: [PATCH 2/2] IntelSiliconPkg/IntelVTdDxe: Add explicit NULL pointer checks
Date: Tue, 1 Aug 2017 04:56:45 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A981568@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20170801043203.23040-3-hao.a.wu@intel.com>

Reviewed-by: jiewen.yao@intel.com

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao
> Wu
> Sent: Tuesday, August 1, 2017 12:32 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [edk2] [PATCH 2/2] IntelSiliconPkg/IntelVTdDxe: Add explicit NULL
> pointer checks
> 
> Add explicit NULL pointer check to make the codes more straight-forward.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  IntelSiliconPkg/IntelVTdDxe/TranslationTable.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
> b/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
> index 0cff2cc939..5af4a4627b 100644
> --- a/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
> +++ b/IntelSiliconPkg/IntelVTdDxe/TranslationTable.c
> @@ -862,6 +862,8 @@ SetAccessAttribute (
>    VTD_SECOND_LEVEL_PAGING_ENTRY *SecondLevelPagingEntry;
>    UINT64                        Pt;
> 
> +  SecondLevelPagingEntry = NULL;
> +
>    DEBUG ((DEBUG_INFO,"SetAccessAttribute (S%04x B%02x D%02x F%02x)
> (0x%016lx - 0x%08x, %x)\n", Segment, SourceId.Bits.Bus, SourceId.Bits.Device,
> SourceId.Bits.Function, BaseAddress, (UINTN)Length, IoMmuAccess));
> 
>    VtdIndex = FindVtdIndexByPciDevice (Segment, SourceId, &ExtContextEntry,
> &ContextEntry);
> @@ -884,7 +886,7 @@ SetAccessAttribute (
>        SecondLevelPagingEntry = (VOID *)(UINTN)LShiftU64
> (ExtContextEntry->Bits.SecondLevelPageTranslationPointer, 12);
>        DEBUG ((DEBUG_VERBOSE,"SecondLevelPagingEntry - 0x%x (S%04x
> B%02x D%02x F%02x)\n", SecondLevelPagingEntry, Segment, SourceId.Bits.Bus,
> SourceId.Bits.Device, SourceId.Bits.Function));
>      }
> -  } else {
> +  } else if (ContextEntry != NULL) {
>      if (ContextEntry->Bits.Present == 0) {
>        SecondLevelPagingEntry = CreateSecondLevelPagingEntry (VtdIndex, 0);
>        DEBUG ((DEBUG_VERBOSE,"SecondLevelPagingEntry - 0x%x (S%04x
> B%02x D%02x F%02x) New\n", SecondLevelPagingEntry, Segment,
> SourceId.Bits.Bus, SourceId.Bits.Device, SourceId.Bits.Function));
> @@ -959,7 +961,7 @@ AlwaysEnablePageAttribute (
>      ExtContextEntry->Bits.SecondLevelPageTranslationPointer = Pt;
>      ExtContextEntry->Bits.DomainIdentifier = ((1 <<
> (UINT8)((UINTN)mVtdUnitInformation[VtdIndex].CapReg.Bits.ND * 2 + 4)) - 1);
>      ExtContextEntry->Bits.Present = 1;
> -  } else {
> +  } else if (ContextEntry != NULL) {
>      ContextEntry->Bits.SecondLevelPageTranslationPointer = Pt;
>      ContextEntry->Bits.DomainIdentifier = ((1 <<
> (UINT8)((UINTN)mVtdUnitInformation[VtdIndex].CapReg.Bits.ND * 2 + 4)) - 1);
>      ContextEntry->Bits.Present = 1;
> --
> 2.12.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


      reply	other threads:[~2017-08-01  4:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  4:32 [PATCH 0/2] IntelSiliconPkg/IntelVTdDxe: Code refinements Hao Wu
2017-08-01  4:32 ` [PATCH 1/2] IntelSiliconPkg/IntelVTdDxe: Fix typo for VTd IOTLB domain ID Hao Wu
2017-08-01  4:56   ` Yao, Jiewen
2017-08-01  4:32 ` [PATCH 2/2] IntelSiliconPkg/IntelVTdDxe: Add explicit NULL pointer checks Hao Wu
2017-08-01  4:56   ` Yao, Jiewen [this message]

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=74D8A39837DF1E4DA445A8C0B3885C503A981568@shsmsx102.ccr.corp.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