[edk2-devel] [PATCH] FatPkg/EnhancedFatDxe: Fix various Coverity issues

2023-01-04 Thread Ranbir Singh via groups.io
The functions FatGetDirEntInfo and FatOpenDirEnt in the file FatPkg/EnhancedFatDxe/DirectoryManage.c contains the code statements Cluster            = (Entry->FileClusterHigh << 16) | Entry->FileCluster; and OFile->FileCluster = ((DirEnt->Entry.FileClusterHigh) << 16) |

[edk2-devel] [PATCH] SecurityPkg/Tcg/Tcg2Config: Fix REVERSE_INULL Coverity issue

2023-01-04 Thread Ranbir Singh via groups.io
The function Tcg2ConfigDriverEntryPoint at the point of creating a private data structure makes a call to AllocateCopyPool and stores the return value in PrivateData. Thereafter it does a check ASSERT (PrivateData != NULL); but this is applicable only in DEBUG mode. In Release mode, the code

[edk2-devel] [PATCH] UefiCpuPkg/Universal/Acpi/S3Resume2Pei: Fix FORWARD_NULL Coverity issue

2023-01-04 Thread Ranbir Singh via groups.io
The function S3ResumeExecuteBootScript at the point of preparing data for return back makes a call to AllocatePool and stores the return value in PeiS3ResumeState. Thereafter it does a check if (PeiS3ResumeState == NULL) { The if block further has ASSERT (FALSE); If PeiS3ResumeState is NULL,

[edk2-devel] [PATCH] SecurityPkg/Library/HashLibBaseCryptoRouter: Fix NULL_RETURNS Coverity issue

2023-01-04 Thread Ranbir Singh via groups.io
In file SecurityPkg/Library/HashLibBaseCryptoRouter/ HashLibBaseCryptoRouterPei.c, the function CheckSupportedHashMaskMismatch calls InternalGetHashInterfaceHob and stores return value in HashInterfaceHobLast. Thereafter, it does ASSERT (HashInterfaceHobLast != NULL); but this comes into play

[edk2-devel] [PATCH] NetworkPkg/Dhcp6Dxe: Fix FORWARD_NULL Coverity issue

2023-01-04 Thread Ranbir Singh via groups.io
The function Dhcp6HandleStateful checks if (Instance->Config == NULL) { goto ON_CONTINUE; } At label ON_CONTINUE, UdpIoRecvDatagram function is called and if for whatever reasons its return value is not EFI_SUCCESS, then the check if (EFI_ERROR (Status)) at label ON_EXIT passes leading to

[edk2-devel] [PATCH] MdeModulePkg/Bus/Usb/UsbMouseDxe: Fix REVERSE_INULL Coverity issue

2023-01-04 Thread Ranbir Singh via groups.io
The function USBMouseDriverBindingStart do have ASSERT (UsbMouseDevice != NULL); after AllocateZeroPool, but it is applicable only in DEBUG mode. In RELEASE mode, the code proceeds to dereference "UsbMouseDevice" which will lead to CRASH. Hence, for safety add NULL pointer checks always. The

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix FORWARD_NULL Coverity issues

2023-01-04 Thread Ranbir Singh via groups.io
The functions UsbHcGetHostAddrForPciAddr, UsbHcGetPciAddrForHostAddr and UsbHcFreeMem do have ASSERT ((Block != NULL)); statements after for loop, but these are applicable only in DEBUG mode. In RELEASE mode, if for whatever reasons there is no match inside for loop and the loop exits because of

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/NvmExpressPei: Fix DEADCODE Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
The code can reach line 65 only through the else path above at line 53. The else path already has the same NULL check at line 55 and hence the duplicate code lines are totally redundant which can be deleted. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4220 Signed-off-by: Ranbir Singh ---

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Fix NULL_RETURNS Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
The function StartPciDevices has a check ASSERT (RootBridge != NULL); but this comes into play only in DEBUG mode. In Release mode, there is no handling if the RootBridge value is NULL and the code proceeds to unconditionally dereference "RootBridge" which will lead to CRASH. Hence, for safety

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/PciBusDxe: Fix various Coverity issues

2023-01-03 Thread Ranbir Singh via groups.io
The function PciHotPlugRequestNotify in MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c has two if blocks towards the end of function both containing return. Due to the parameter checks ensured at the beginning of the function, one of the two if blocks is bound to come in execution flow. Hence,

[edk2-devel] [PATCH] MdeModulePkg/Core/Dxe: Fix FORWARD_NULL Coverity issues

2023-01-03 Thread Ranbir Singh via groups.io
The functions CoreConvertSpace and CoreAllocateSpace in MdeModulePkg/Core/Dxe/Gcd/Gcd.c has ASSERT (FALSE); at lines 755 and 1155 which gets hit when Operation neither include GCD_MEMORY_SPACE_OPERATION nor include GCD_IO_SPACE_OPERATION but this comes into play only in DEBUG mode. In Release

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/PciHostBridgeDxe: Fix various Coverity issues

2023-01-03 Thread Ranbir Singh via groups.io
The function NotifyPhase has a check ASSERT (Index < TypeMax); but this comes into play only in DEBUG mode. In Release mode, there is no handling if the Index value is within array limits or not. If for whatever reasons, the Index does not get re-assigned to Index2 at line 137, then it remains

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/UhciDxe: Fix various Coverity issues

2023-01-03 Thread Ranbir Singh via groups.io
The function UhciConvertPollRate has a check ASSERT (Interval != 0); but this comes into play only in DEBUG mode. In Release mode, there is no handling if the Interval parameter value is ZERO. To avoid shifting by a negative amount later in the code flow in this undesirable case, it is better to

[edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/EhciDxe: Fix FORWARD_NULL Coverity issues

2023-01-03 Thread Ranbir Singh via groups.io
The functions UsbHcGetPciAddressForHostMem and UsbHcFreeMem do have ASSERT ((Block != NULL)); statements after for loop, but these are applicable only in DEBUG mode. In RELEASE mode, if for whatever reasons there is no match inside for loop and the loop exits because of Block != NULL; condition,

[edk2-devel] [PATCH] MdeModulePkg/Bus/Ata/AtaBusDxe: Fix SIGN_EXTENSION Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
Line number 365 does contain a typecast with UINT32, but it is after all the operations (16-bit left shift followed by OR'ing) are over. To avoid any SIGN_EXTENSION, typecast the intermediate result after 16-bit left shift operation immediately with UINT32. REF:

[edk2-devel] [PATCH] MdeModulePkg/Bus/Ata/AtaAtapiPassThru: Fix SIGN_EXTENSION Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
Line number 1348 does contain a typecast with UINT32, but it is after all the operations (16-bit left shift followed by OR'ing) are over. To avoid any SIGN_EXTENSION, typecast the intermediate result after 16-bit left shift operation immediately with UINT32. REF:

Re: [edk2-devel] 回复: [edk2-devel] [PATCH] MdeModulePkg/Bus/Ata/AhciPei: Fix DEADCODE Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
The code can reach line 69 only through the else path above at line 57. The else path already has the same NULL check at line 59 and hence the duplicate code lines are totally redundant which can be deleted. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4201 Signed-off-by: Ranbir Singh ---

Re: [edk2-devel] [PATCH] IntelFsp2Pkg/Library/BaseFspCommonLib: Fix OVERRUN Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
Copying patch contents directly in the message below ... >From e0df5b0a34f1b96aa9610c5eef9161cbbca717d2 Mon Sep 17 00:00:00 2001 From: Ranbir Singh Date: Thu, 22 Dec 2022 10:57:21 +0530 Subject: [PATCH] IntelFsp2Pkg/Library/BaseFspCommonLib: Fix OVERRUN Coverity issue FspData->PerfIdx is

[edk2-devel] [PATCH] IntelFsp2Pkg/Library/BaseFspCommonLib: Fix OVERRUN Coverity issue

2023-01-03 Thread Ranbir Singh via groups.io
Attached patch fixes the *OVERRUN* Coverity issue in the file *IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c* Please consider it for review and merge. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97907):

[edk2-devel] FatPkg: Fix EnhancedFatDxe driver coverity issues

2022-12-26 Thread Ranbir Singh via groups.io
Hi All, Attached patch contains the changes fixing the issues pointed by Coverity scan on FatPkg component. Please review if the changes are safe to be considered. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97759):

[edk2-devel] [PATCH] MdeModulePkg/Bus/Ata/AhciPei: Fix DEADCODE Coverity issue

2022-12-26 Thread Ranbir Singh via groups.io
Hi All, The attached patch fixes the DEADCODE issue in MdeModulePkg/Bus/Ata/AhciPei. Please review. Best Regards, Ranbir Singh -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97760): https://edk2.groups.io/g/devel/message/97760 Mute