[edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token to avoid null pointer

Guomin Jiang posted 1 patch 4 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20200326064250.1519-1-guomin.jiang@intel.com
MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token to avoid null pointer
Posted by Guomin Jiang 4 years, 1 month ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286

Token pointer may be NULL, it should be checked before use it.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
---
 MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
index 9f42abe7e2..721f264377 100644
--- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
+++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
@@ -1367,7 +1367,14 @@ 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_INFO,
+    "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n",
+    Lba,
+    BlockNum,
+    (Token != NULL) ? Token->Event : NULL,
+    Status
+    ));
 
   return Status;
 }
-- 
2.25.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56363): https://edk2.groups.io/g/devel/message/56363
Mute This Topic: https://groups.io/mt/72558979/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token to avoid null pointer
Posted by Wu, Hao A 4 years, 1 month ago
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Guomin Jiang
> Sent: Thursday, March 26, 2020 2:43 PM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A; Ni, Ray
> Subject: [edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token to
> avoid null pointer
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286
> 
> Token pointer may be NULL, it should be checked before use it.


Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu


> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
> ---
>  MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> index 9f42abe7e2..721f264377 100644
> --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> @@ -1367,7 +1367,14 @@ 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_INFO,
> 
> +    "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n",
> 
> +    Lba,
> 
> +    BlockNum,
> 
> +    (Token != NULL) ? Token->Event : NULL,
> 
> +    Status
> 
> +    ));
> 
> 
> 
>    return Status;
> 
>  }
> 
> --
> 2.25.1.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> View/Reply Online (#56363): https://edk2.groups.io/g/devel/message/56363
> Mute This Topic: https://groups.io/mt/72558979/1768737
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub  [hao.a.wu@intel.com]
> -=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56364): https://edk2.groups.io/g/devel/message/56364
Mute This Topic: https://groups.io/mt/72558979/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token to avoid null pointer
Posted by Wu, Hao A 4 years, 1 month ago
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Wu,
> Hao A
> Sent: Thursday, March 26, 2020 2:51 PM
> To: devel@edk2.groups.io; Jiang, Guomin
> Cc: Wang, Jian J; Ni, Ray
> Subject: Re: [edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token
> to avoid null pointer
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Guomin Jiang
> > Sent: Thursday, March 26, 2020 2:43 PM
> > To: devel@edk2.groups.io
> > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray
> > Subject: [edk2-devel] [PATCH v3] MdeModulePkg/SdDxe: Check the Token to
> > avoid null pointer
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2286
> >
> > Token pointer may be NULL, it should be checked before use it.
> 
> 
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>


Patch pushed via commit 695d90b9b1.

Best Regards,
Hao Wu


> 
> Best Regards,
> Hao Wu
> 
> 
> >
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
> > ---
> >  MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c | 9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> > b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> > index 9f42abe7e2..721f264377 100644
> > --- a/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> > +++ b/MdeModulePkg/Bus/Sd/SdDxe/SdBlockIo.c
> > @@ -1367,7 +1367,14 @@ 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_INFO,
> >
> > +    "SdEraseBlocks(): Lba 0x%x BlkNo 0x%x Event %p with %r\n",
> >
> > +    Lba,
> >
> > +    BlockNum,
> >
> > +    (Token != NULL) ? Token->Event : NULL,
> >
> > +    Status
> >
> > +    ));
> >
> >
> >
> >    return Status;
> >
> >  }
> >
> > --
> > 2.25.1.windows.1
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> >
> > View/Reply Online (#56363): https://edk2.groups.io/g/devel/message/56363
> > Mute This Topic: https://groups.io/mt/72558979/1768737
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub  [hao.a.wu@intel.com]
> > -=-=-=-=-=-=
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56435): https://edk2.groups.io/g/devel/message/56435
Mute This Topic: https://groups.io/mt/72558979/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-