public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Paulo Alcantara <pcacjr@zytor.com>
To: Hao Wu <hao.a.wu@intel.com>, edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>, Star Zeng <star.zeng@intel.com>,
	Eric Dong <eric.dong@intel.com>
Subject: Re: [PATCH] MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference
Date: Mon, 25 Sep 2017 23:25:08 -0300	[thread overview]
Message-ID: <9F701135-5993-4B69-A6D6-4A5313EB1886@zytor.com> (raw)
In-Reply-To: <20170926013648.23788-1-hao.a.wu@intel.com>



On September 25, 2017 10:36:48 PM GMT-03:00, Hao Wu <hao.a.wu@intel.com> wrote:
>Within function GetAllocationDescriptorLsn():
>
>The call to GetPdFromLongAd() may return NULL and it will be later
>dereferenced in GetShortAdLsn().
>
>This commit adds ASSERT to resolve the potential NULL pointer
>dereference.
>
>Cc: Paulo Alcantara <pcacjr@zytor.com>
>Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>Cc: Star Zeng <star.zeng@intel.com>
>Cc: Eric Dong <eric.dong@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Hao Wu <hao.a.wu@intel.com>
>---
> MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
>diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
>b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
>index b336ffc553..e048d95d31 100644
>--- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
>+++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
>@@ -748,12 +748,17 @@ GetAllocationDescriptorLsn (
>   IN VOID                            *Ad
>   )
> {
>+  UDF_PARTITION_DESCRIPTOR *PartitionDesc;
>+
>   if (RecordingFlags == LongAdsSequence) {
>    return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad);
>   } else if (RecordingFlags == ShortAdsSequence) {
>+    PartitionDesc = GetPdFromLongAd (Volume, ParentIcb);
>+    ASSERT (PartitionDesc != NULL);
>+
>     return GetShortAdLsn (
>       Volume,
>-      GetPdFromLongAd (Volume, ParentIcb),
>+      PartitionDesc,
>       (UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad
>       );
>   }

Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>

Thanks!
Paulo

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


      reply	other threads:[~2017-09-26  2:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-26  1:36 [PATCH] MdeModulePkg/UdfDxe: Resolve potential NULL pointer dereference Hao Wu
2017-09-26  2:25 ` Paulo Alcantara [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=9F701135-5993-4B69-A6D6-4A5313EB1886@zytor.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