From: Jeff Brasen <jbrasen@nvidia.com>
To: <edk2-devel@lists.01.org>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Subject: [PATCH] MdeModulePkg/SdDxe: Fix potential NULL pointer access
Date: Fri, 9 Nov 2018 10:17:19 -0700 [thread overview]
Message-ID: <2e217c22948e3acd3a12c99940d1a3964f648a7c.1541783820.git.jbrasen@nvidia.com> (raw)
SdReadWrite can be called with a NULL Token for synchronous operations.
Add guard for DEBUG print to only print event pointer with Token is not
NULL.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
index b8d115a..920e3cd 100644
--- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
+++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
@@ -670,8 +670,11 @@ SdReadWrite (
if (EFI_ERROR (Status)) {
return Status;
}
- DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status));
-
+ if (Token != NULL) {
+ DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", IsRead ? "Read" : "Write", Lba, BlockNum, Token->Event, Status));
+ } else {
+ DEBUG ((DEBUG_BLKIO, "Sd%a(): Lba 0x%x BlkNo 0x%x with %r\n", IsRead ? "Read" : "Write", Lba, BlockNum, Status));
+ }
Lba += BlockNum;
Buffer = (UINT8*)Buffer + BufferSize;
Remaining -= BlockNum;
--
2.7.4
next reply other threads:[~2018-11-09 17:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-09 17:17 Jeff Brasen [this message]
2018-11-16 5:33 ` [PATCH] MdeModulePkg/SdDxe: Fix potential NULL pointer access Wu, Hao A
2018-11-16 6:11 ` Jeff Brasen
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=2e217c22948e3acd3a12c99940d1a3964f648a7c.1541783820.git.jbrasen@nvidia.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