[edk2-devel] [edk2-platforms PATCH 3/8] Marvell/Drivers: Pp2Dxe: Fix Pp2SnpStart & Pp2SnpStop
Marcin Wojtas
mw at semihalf.com
Mon Mar 14 15:38:32 UTC 2022
Add sanity check if the SNP instance pointer is not NULL
in SnpStart/Stop callbacks.
Signed-off-by: Marcin Wojtas <mw at semihalf.com>
---
Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c | 23 +++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c
index 3e09fafc4c..5f487c4dc6 100644
--- a/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c
+++ b/Silicon/Marvell/Drivers/Net/Pp2Dxe/Pp2Dxe.c
@@ -575,11 +575,19 @@ Pp2SnpStart (
)
{
PP2DXE_CONTEXT *Pp2Context;
- UINT32 State = This->Mode->State;
EFI_TPL SavedTpl;
+ UINT32 State;
+
+ /* Check Snp Instance. */
+ if (This == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
SavedTpl = gBS->RaiseTPL (TPL_CALLBACK);
+
Pp2Context = INSTANCE_FROM_SNP(This);
+ State = This->Mode->State;
if (State != EfiSimpleNetworkStopped) {
switch (State) {
@@ -604,9 +612,18 @@ Pp2SnpStop (
)
{
EFI_TPL SavedTpl;
+ PP2DXE_CONTEXT *Pp2Context;
+ UINT32 State;
+
+ // Check Snp Instance
+ if (This == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
SavedTpl = gBS->RaiseTPL (TPL_CALLBACK);
- PP2DXE_CONTEXT *Pp2Context = INSTANCE_FROM_SNP(This);
- UINT32 State = This->Mode->State;
+
+ Pp2Context = INSTANCE_FROM_SNP(This);
+ State = This->Mode->State;
if (State != EfiSimpleNetworkStarted && State != EfiSimpleNetworkInitialized) {
switch (State) {
--
2.29.0
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87542): https://edk2.groups.io/g/devel/message/87542
Mute This Topic: https://groups.io/mt/89776252/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list