public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/Bus: Potential NULL pointer on Token
@ 2020-02-21  6:00 GuoMinJ
  2020-02-21 16:22 ` [edk2-devel] " Laszlo Ersek
  0 siblings, 1 reply; 2+ messages in thread
From: GuoMinJ @ 2020-02-21  6:00 UTC (permalink / raw)
  To: devel; +Cc: GuoMinJ

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286

Token pointer may be NULL, it is should be check before use it.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
---
 MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
index 9f42abe7e2..25ab5abb2d 100644
--- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
+++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
@@ -1367,7 +1367,12 @@ SdEraseBlocks (
     return Status;
   }
 
-  DEBUG ((EFI_D_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", Lba, BlockNum, Token->Event, Status));
+  DEBUG ((DEBUG_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x with %r, ", Lba, BlockNum, Status));
+  if ((Token != NULL) && (Token->Event != NULL)) {
+    DEBUG ((DEBUG_ERROR, "Event pointer is %p\n", Token->Event));
+  else {
+    DEBUG ((DEBUG_ERROR, "Event is meaningless\n"));
+  }
 
   return Status;
 }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus: Potential NULL pointer on Token
  2020-02-21  6:00 [PATCH] MdeModulePkg/Bus: Potential NULL pointer on Token GuoMinJ
@ 2020-02-21 16:22 ` Laszlo Ersek
  0 siblings, 0 replies; 2+ messages in thread
From: Laszlo Ersek @ 2020-02-21 16:22 UTC (permalink / raw)
  To: devel, newexplorerj

On 02/21/20 07:00, GuoMinJ wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286
> 
> Token pointer may be NULL, it is should be check before use it.
> 
> Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
> ---
>  MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> index 9f42abe7e2..25ab5abb2d 100644
> --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> @@ -1367,7 +1367,12 @@ SdEraseBlocks (
>      return Status;
>    }
>  
> -  DEBUG ((EFI_D_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n", Lba, BlockNum, Token->Event, Status));
> +  DEBUG ((DEBUG_ERROR, "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x with %r, ", Lba, BlockNum, Status));
> +  if ((Token != NULL) && (Token->Event != NULL)) {
> +    DEBUG ((DEBUG_ERROR, "Event pointer is %p\n", Token->Event));
> +  else {
> +    DEBUG ((DEBUG_ERROR, "Event is meaningless\n"));
> +  }
>  
>    return Status;
>  }
> 

Please update the subject line; it should say "SdDxe" somewhere.

Thanks
Laszlo


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-21 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-21  6:00 [PATCH] MdeModulePkg/Bus: Potential NULL pointer on Token GuoMinJ
2020-02-21 16:22 ` [edk2-devel] " Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox