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

sivaparvathi C via groups.io posted 1 patch 1 week, 2 days ago
Failed in applying to current master (apply log)
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBus.c   |  3 +++
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 10 +++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
[edk2-devel] [edk2] [PATCH]MdeModulePkg\scsi: Coverity scan flags multiple issues in edk2-stable202205
Posted by sivaparvathi C via groups.io 1 week, 2 days ago
 Attached changes to resolve the coverity Issues

 Signed-off-by: sivaparvathic@ami.com
To: sivaparvathic@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/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
回复: [edk2-devel] [edk2] [PATCH]MdeModulePkg\scsi: Coverity scan flags multiple issues in edk2-stable202205
Posted by gaoliming via groups.io 6 days, 18 hours ago
This change is good to me. Reviewed-by: Liming Gao
<gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 sivaparvathi
> C via groups.io
> 发送时间: 2022年8月2日 13:00
> 收件人: devel@edk2.groups.io
> 抄送: Vasudevan Sambandan <vasudevans@ami.com>; Sundaresan S
> <sundaresans@ami.com>; Sivaparvathi Chellaiah <sivaparvathic@ami.com>
> 主题: [edk2-devel] [edk2] [PATCH]MdeModulePkg\scsi: Coverity scan flags
> multiple issues in edk2-stable202205
> 
>  Attached changes to resolve the coverity Issues
> 
>  Signed-off-by: sivaparvathic@ami.com
> To: sivaparvathic@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 (#92144): https://edk2.groups.io/g/devel/message/92144
Mute This Topic: https://groups.io/mt/92829971/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-