public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check before using it
@ 2019-02-01 10:44 Maggie Chu
  2019-02-14  7:18 ` Dong, Eric
  0 siblings, 1 reply; 2+ messages in thread
From: Maggie Chu @ 2019-02-01 10:44 UTC (permalink / raw)
  To: edk2-devel; +Cc: Chao Zhang, Jiewen Yao, Eric Dong

https://bugzilla.tianocore.org/show_bug.cgi?id=1503
A pointer variable should be checked if it is NULL or Valid before using it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Maggie Chu <maggie.chu@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
---
 SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
index 734c5f06ff..f79f9f7282 100644
--- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
+++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
@@ -436,6 +436,9 @@ BuildOpalDeviceInfoAta (
 
   DevInfoAta = AllocateZeroPool (DevInfoLengthAta);
   ASSERT (DevInfoAta != NULL);
+  if (DevInfoAta == NULL) {
+    return;
+  }
 
   TempDevInfoAta = DevInfoAta;
   TmpDev = mOpalDriver.DeviceList;
@@ -527,6 +530,9 @@ BuildOpalDeviceInfoNvme (
 
   DevInfoNvme = AllocateZeroPool (DevInfoLengthNvme);
   ASSERT (DevInfoNvme != NULL);
+  if (DevInfoNvme == NULL) {
+    return;
+  }
 
   TempDevInfoNvme = DevInfoNvme;
   TmpDev = mOpalDriver.DeviceList;
-- 
2.16.2.windows.1



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

* Re: [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check before using it
  2019-02-01 10:44 [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check before using it Maggie Chu
@ 2019-02-14  7:18 ` Dong, Eric
  0 siblings, 0 replies; 2+ messages in thread
From: Dong, Eric @ 2019-02-14  7:18 UTC (permalink / raw)
  To: Chu, Maggie, edk2-devel@lists.01.org; +Cc: Yao, Jiewen, Zhang, Chao B

Hi Maggie,

Thanks for your contribution.

Reviewed-by: Eric Dong <eric.dong@intel.com>

Pushed: d72d8561fbe03a64e01c2ad57a93777de4b9ae2f

Thanks,
Eric

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Maggie Chu
> Sent: Friday, February 1, 2019 6:44 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Dong, Eric <eric.dong@intel.com>;
> Zhang, Chao B <chao.b.zhang@intel.com>
> Subject: [edk2] [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check
> before using it
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1503
> A pointer variable should be checked if it is NULL or Valid before using it.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Maggie Chu <maggie.chu@intel.com>
> Cc: Chao Zhang <chao.b.zhang@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> ---
>  SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> index 734c5f06ff..f79f9f7282 100644
> --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.c
> @@ -436,6 +436,9 @@ BuildOpalDeviceInfoAta (
> 
>    DevInfoAta = AllocateZeroPool (DevInfoLengthAta);
>    ASSERT (DevInfoAta != NULL);
> +  if (DevInfoAta == NULL) {
> +    return;
> +  }
> 
>    TempDevInfoAta = DevInfoAta;
>    TmpDev = mOpalDriver.DeviceList;
> @@ -527,6 +530,9 @@ BuildOpalDeviceInfoNvme (
> 
>    DevInfoNvme = AllocateZeroPool (DevInfoLengthNvme);
>    ASSERT (DevInfoNvme != NULL);
> +  if (DevInfoNvme == NULL) {
> +    return;
> +  }
> 
>    TempDevInfoNvme = DevInfoNvme;
>    TmpDev = mOpalDriver.DeviceList;
> --
> 2.16.2.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

end of thread, other threads:[~2019-02-14  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-01 10:44 [PATCH] SecurityPkg/OpalPassword: Add NULL pointer check before using it Maggie Chu
2019-02-14  7:18 ` Dong, Eric

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