MdeModulePkg/scsi :Coverity scan flags multiple issues in edk2-stable202205

Added changes to resolve the SCSI driver Coverity issues.

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Sivaparvathi chellaiah <sivaparvathic@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
Sivaparvathi C 2022-10-27 16:36:59 +05:30 committed by mergify[bot]
parent b84f32ae5b
commit eae9e51d98
2 changed files with 19 additions and 10 deletions

View File

@ -3,6 +3,8 @@
Extended SCSI Pass Thru protocol in the system.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -531,6 +533,9 @@ SCSIBusDriverBindingStart (
// then create handle and install scsi i/o protocol.
//
Status = ScsiScanCreateDevice (This, Controller, &ScsiTargetId, Lun, ScsiBusDev);
if (Status == EFI_OUT_OF_RESOURCES) {
goto ErrorExit;
}
}
return EFI_SUCCESS;

View File

@ -3,6 +3,10 @@
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) 1985 - 2022, American Megatrends International LLC.<BR>
<<<<<<< HEAD
=======
>>>>>>> ace365b4e0 (MdeModulePkg/scsi :Coverity scan flags multiple issues in edk2-stable202205)
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@ -4296,7 +4300,7 @@ BackOff:
if ((TargetStatus == EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION) || (EFI_ERROR (ReturnStatus))) {
DEBUG ((DEBUG_ERROR, "ScsiDiskRead10: Check Condition happened!\n"));
Status = DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
if (Action == ACTION_RETRY_COMMAND_LATER) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
@ -4420,7 +4424,7 @@ BackOff:
if ((TargetStatus == EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION) || (EFI_ERROR (ReturnStatus))) {
DEBUG ((DEBUG_ERROR, "ScsiDiskWrite10: Check Condition happened!\n"));
Status = DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
if (Action == ACTION_RETRY_COMMAND_LATER) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
@ -4543,7 +4547,7 @@ BackOff:
if ((TargetStatus == EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION) || (EFI_ERROR (ReturnStatus))) {
DEBUG ((DEBUG_ERROR, "ScsiDiskRead16: Check Condition happened!\n"));
Status = DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
if (Action == ACTION_RETRY_COMMAND_LATER) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
@ -4667,7 +4671,7 @@ BackOff:
if ((TargetStatus == EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION) || (EFI_ERROR (ReturnStatus))) {
DEBUG ((DEBUG_ERROR, "ScsiDiskWrite16: Check Condition happened!\n"));
Status = DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
DetectMediaParsingSenseKeys (ScsiDiskDevice, ScsiDiskDevice->SenseData, SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA), &Action);
if (Action == ACTION_RETRY_COMMAND_LATER) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
@ -4777,12 +4781,12 @@ ScsiDiskNotify (
if (Request->TargetStatus == EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION) {
DEBUG ((DEBUG_ERROR, "ScsiDiskNotify: Check Condition happened!\n"));
Status = DetectMediaParsingSenseKeys (
ScsiDiskDevice,
Request->SenseData,
Request->SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA),
&Action
);
DetectMediaParsingSenseKeys (
ScsiDiskDevice,
Request->SenseData,
Request->SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA),
&Action
);
if (Action == ACTION_RETRY_COMMAND_LATER) {
if (++Request->TimesRetry > MaxRetry) {
Token->TransactionStatus = EFI_DEVICE_ERROR;