public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison
@ 2023-09-06 17:34 Michael Kubacki
  2023-09-06 23:32 ` Yao, Jiewen
  2023-09-07 22:01 ` Michael D Kinney
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Kubacki @ 2023-09-06 17:34 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Liming Gao, Zhiguang Liu, Rebecca Cran

From: Michael Kubacki <michael.kubacki@microsoft.com>

Removes the comparison since unsigned values are always greater than
or equal to 0.

See the following CodeQL query for more info:
/cpp/cpp-unsigned-comparison-zero/

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Rebecca Cran <rebecca@bsdio.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
 MdePkg/Library/TdxLib/Rtmr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdePkg/Library/TdxLib/Rtmr.c b/MdePkg/Library/TdxLib/Rtmr.c
index a0283966b353..cbf1dda7bcff 100644
--- a/MdePkg/Library/TdxLib/Rtmr.c
+++ b/MdePkg/Library/TdxLib/Rtmr.c
@@ -51,7 +51,7 @@ TdExtendRtmr (
 
   ASSERT (Data != NULL);
   ASSERT (DataLen == SHA384_DIGEST_SIZE);
-  ASSERT (Index >= 0 && Index < RTMR_COUNT);
+  ASSERT (Index < RTMR_COUNT);
 
   if ((Data == NULL) || (DataLen != SHA384_DIGEST_SIZE) || (Index >= RTMR_COUNT)) {
     return EFI_INVALID_PARAMETER;
-- 
2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108335): https://edk2.groups.io/g/devel/message/108335
Mute This Topic: https://groups.io/mt/101198214/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison
  2023-09-06 17:34 [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison Michael Kubacki
@ 2023-09-06 23:32 ` Yao, Jiewen
  2023-09-08  0:38   ` 回复: " gaoliming via groups.io
  2023-09-07 22:01 ` Michael D Kinney
  1 sibling, 1 reply; 4+ messages in thread
From: Yao, Jiewen @ 2023-09-06 23:32 UTC (permalink / raw)
  To: devel@edk2.groups.io, mikuback@linux.microsoft.com
  Cc: Kinney, Michael D, Gao, Liming, Liu, Zhiguang, Rebecca Cran

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> Kubacki
> Sent: Thursday, September 7, 2023 1:34 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Rebecca
> Cran <rebecca@bsdio.com>
> Subject: [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove
> unnecessary comparison
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> Removes the comparison since unsigned values are always greater than
> or equal to 0.
> 
> See the following CodeQL query for more info:
> /cpp/cpp-unsigned-comparison-zero/
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>  MdePkg/Library/TdxLib/Rtmr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Library/TdxLib/Rtmr.c b/MdePkg/Library/TdxLib/Rtmr.c
> index a0283966b353..cbf1dda7bcff 100644
> --- a/MdePkg/Library/TdxLib/Rtmr.c
> +++ b/MdePkg/Library/TdxLib/Rtmr.c
> @@ -51,7 +51,7 @@ TdExtendRtmr (
> 
>    ASSERT (Data != NULL);
>    ASSERT (DataLen == SHA384_DIGEST_SIZE);
> -  ASSERT (Index >= 0 && Index < RTMR_COUNT);
> +  ASSERT (Index < RTMR_COUNT);
> 
>    if ((Data == NULL) || (DataLen != SHA384_DIGEST_SIZE) || (Index >=
> RTMR_COUNT)) {
>      return EFI_INVALID_PARAMETER;
> --
> 2.42.0.windows.2
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#108335): https://edk2.groups.io/g/devel/message/108335
> Mute This Topic: https://groups.io/mt/101198214/1772286
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [jiewen.yao@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108346): https://edk2.groups.io/g/devel/message/108346
Mute This Topic: https://groups.io/mt/101198214/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison
  2023-09-06 17:34 [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison Michael Kubacki
  2023-09-06 23:32 ` Yao, Jiewen
@ 2023-09-07 22:01 ` Michael D Kinney
  1 sibling, 0 replies; 4+ messages in thread
From: Michael D Kinney @ 2023-09-07 22:01 UTC (permalink / raw)
  To: mikuback@linux.microsoft.com, devel@edk2.groups.io
  Cc: Gao, Liming, Liu, Zhiguang, Rebecca Cran, Kinney, Michael D

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: mikuback@linux.microsoft.com <mikuback@linux.microsoft.com>
> Sent: Wednesday, September 6, 2023 10:34 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Rebecca Cran <rebecca@bsdio.com>
> Subject: [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary
> comparison
> 
> From: Michael Kubacki <michael.kubacki@microsoft.com>
> 
> Removes the comparison since unsigned values are always greater than
> or equal to 0.
> 
> See the following CodeQL query for more info:
> /cpp/cpp-unsigned-comparison-zero/
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Rebecca Cran <rebecca@bsdio.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
>  MdePkg/Library/TdxLib/Rtmr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Library/TdxLib/Rtmr.c b/MdePkg/Library/TdxLib/Rtmr.c
> index a0283966b353..cbf1dda7bcff 100644
> --- a/MdePkg/Library/TdxLib/Rtmr.c
> +++ b/MdePkg/Library/TdxLib/Rtmr.c
> @@ -51,7 +51,7 @@ TdExtendRtmr (
> 
>    ASSERT (Data != NULL);
>    ASSERT (DataLen == SHA384_DIGEST_SIZE);
> -  ASSERT (Index >= 0 && Index < RTMR_COUNT);
> +  ASSERT (Index < RTMR_COUNT);
> 
>    if ((Data == NULL) || (DataLen != SHA384_DIGEST_SIZE) || (Index >=
> RTMR_COUNT)) {
>      return EFI_INVALID_PARAMETER;
> --
> 2.42.0.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108423): https://edk2.groups.io/g/devel/message/108423
Mute This Topic: https://groups.io/mt/101198214/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

* 回复: [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison
  2023-09-06 23:32 ` Yao, Jiewen
@ 2023-09-08  0:38   ` gaoliming via groups.io
  0 siblings, 0 replies; 4+ messages in thread
From: gaoliming via groups.io @ 2023-09-08  0:38 UTC (permalink / raw)
  To: 'Yao, Jiewen', devel, mikuback
  Cc: 'Kinney, Michael D', 'Liu, Zhiguang',
	'Rebecca Cran'

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: Yao, Jiewen <jiewen.yao@intel.com>
> 发送时间: 2023年9月7日 7:32
> 收件人: devel@edk2.groups.io; mikuback@linux.microsoft.com
> 抄送: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Rebecca Cran <rebecca@bsdio.com>
> 主题: RE: [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove
> unnecessary comparison
> 
> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> 
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> > Kubacki
> > Sent: Thursday, September 7, 2023 1:34 AM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> > <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Rebecca
> > Cran <rebecca@bsdio.com>
> > Subject: [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove
> > unnecessary comparison
> >
> > From: Michael Kubacki <michael.kubacki@microsoft.com>
> >
> > Removes the comparison since unsigned values are always greater than
> > or equal to 0.
> >
> > See the following CodeQL query for more info:
> > /cpp/cpp-unsigned-comparison-zero/
> >
> > Cc: Michael D Kinney <michael.d.kinney@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Rebecca Cran <rebecca@bsdio.com>
> > Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> > ---
> >  MdePkg/Library/TdxLib/Rtmr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/MdePkg/Library/TdxLib/Rtmr.c b/MdePkg/Library/TdxLib/Rtmr.c
> > index a0283966b353..cbf1dda7bcff 100644
> > --- a/MdePkg/Library/TdxLib/Rtmr.c
> > +++ b/MdePkg/Library/TdxLib/Rtmr.c
> > @@ -51,7 +51,7 @@ TdExtendRtmr (
> >
> >    ASSERT (Data != NULL);
> >    ASSERT (DataLen == SHA384_DIGEST_SIZE);
> > -  ASSERT (Index >= 0 && Index < RTMR_COUNT);
> > +  ASSERT (Index < RTMR_COUNT);
> >
> >    if ((Data == NULL) || (DataLen != SHA384_DIGEST_SIZE) || (Index >=
> > RTMR_COUNT)) {
> >      return EFI_INVALID_PARAMETER;
> > --
> > 2.42.0.windows.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#108335):
> https://edk2.groups.io/g/devel/message/108335
> > Mute This Topic: https://groups.io/mt/101198214/1772286
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [jiewen.yao@intel.com]
> > -=-=-=-=-=-=
> >





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108427): https://edk2.groups.io/g/devel/message/108427
Mute This Topic: https://groups.io/mt/101228289/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-08  0:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-06 17:34 [edk2-devel] [PATCH v1 1/1] MdePkg/Library/TdxLib: Remove unnecessary comparison Michael Kubacki
2023-09-06 23:32 ` Yao, Jiewen
2023-09-08  0:38   ` 回复: " gaoliming via groups.io
2023-09-07 22:01 ` Michael D Kinney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox