[edk2-devel] [edk2] [PATCH]MdeModulePkg\scsi: Coverity scan flags multiple issues in edk2-stable202205

sivaparvathi C via groups.io sivaparvathic=ami.com at groups.io
Tue Aug 2 05:00:00 UTC 2022


 Attached changes to resolve the coverity Issues

 Signed-off-by: sivaparvathic at ami.com
To: sivaparvathic at ami.com

---
 MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c   |  3 +++
 MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
index 9ea69ee740..2cc61bb942 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c
@@ -531,6 +531,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;

diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
index 98e84b4ea8..5f4ead7669 100644
--- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
+++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c
@@ -4247,7 +4247,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;

@@ -4371,7 +4371,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;

@@ -4494,7 +4494,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;

@@ -4618,7 +4618,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;

@@ -4728,7 +4728,7 @@ ScsiDiskNotify (
   if (Request->TargetStatus == EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION) {

     DEBUG ((DEBUG_ERROR, "ScsiDiskNotify: Check Condition happened!\n"));



-    Status = DetectMediaParsingSenseKeys (

+    DetectMediaParsingSenseKeys (

                ScsiDiskDevice,

                Request->SenseData,

                Request->SenseDataLength / sizeof (EFI_SCSI_SENSE_DATA),

--
2.31.0.windows.1
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92041): https://edk2.groups.io/g/devel/message/92041
Mute This Topic: https://groups.io/mt/92765259/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