On Sat, 3 Jun 2023 at 18:04, Pedro Falcato <pedro.falc...@gmail.com> wrote:
>
> On Fri, Jun 2, 2023 at 8:42 PM Ranbir Singh <rsi...@ventanamicro.com> wrote:
> >
> > From: Ranbir Singh <ranbir.sin...@dell.com>
> >
> > The return value stored in Status after call to SetDriveParameters
> > is not made of any use thereafter and hence it remains as UNUSED.
> > Assuming, this non-usage is deliberate, the storage in Status can be
> > done away with.
> >
> > Cc: Hao A Wu <hao.a...@intel.com>
> > Cc: Ray Ni <ray...@intel.com>
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4204
> > Signed-off-by: Ranbir Singh <ranbir.sin...@dell.com>
> > ---
> >  MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c 
> > b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
> > index 75403886e44a..c6d637afa989 100644
> > --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
> > +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/IdeMode.c
> > @@ -2555,7 +2555,7 @@ DetectAndConfigIdeDevice (
> >        DriveParameters.Heads          = (UINT8)(((ATA5_IDENTIFY_DATA 
> > *)(&Buffer.AtaData))->heads - 1);
> >        DriveParameters.MultipleSector = (UINT8)((ATA5_IDENTIFY_DATA 
> > *)(&Buffer.AtaData))->multi_sector_cmd_max_sct_cnt;
> >
> > -      Status = SetDriveParameters (Instance, IdeChannel, IdeDevice, 
> > &DriveParameters, NULL);
> > +      SetDriveParameters (Instance, IdeChannel, IdeDevice, 
> > &DriveParameters, NULL);
>
> I'm /fairly/ sure this is wrong and that you need to use Status.
>

Yeah, removing the assignment fixes the coverity warning, but now you
are hiding a bug instead of fixing it.

SetDriveParameters () can apparently fail, and this is being ignored.
At the very least, we should emit a diagnostic here in DEBUG mode to
log this. E.g.,

DEBUG ((DEBUG_WARN, "%a: SetDriveParameters () failed - %r\n",
__func__, Status));


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105687): https://edk2.groups.io/g/devel/message/105687
Mute This Topic: https://groups.io/mt/99293623/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to