Add sanity check if the SNP instance pointer is not NULL in SnpStart/Stop callbacks.
Signed-off-by: Marcin Wojtas <m...@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/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-