public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero
@ 2017-04-01  0:22 Jiaxin Wu
  2017-04-01  5:43 ` Zhang, Lubo
  0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Wu @ 2017-04-01  0:22 UTC (permalink / raw)
  To: edk2-devel; +Cc: Bi Dandan, Zhang Lubo, Ye Ting, Fu Siyuan, Wu Jiaxin

UINTN is unsigned integer, so it's pointless to compare it with zero.

Cc: Bi Dandan <dandan.bi@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 2 +-
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 8e29213..8421caa 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -734,11 +734,11 @@ HttpUrlGetPort (
     Index ++;
   }
 
   Status =  AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data);
 
-  if (Data > HTTP_URI_PORT_MAX_NUM || Data < HTTP_URI_PORT_MIN_NUM) {
+  if (Data > HTTP_URI_PORT_MAX_NUM) {
     return EFI_INVALID_PARAMETER;
   }
 
   *Port = (UINT16) Data;
   return Status;
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
index 5ee0fdc..af82c16 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
@@ -48,11 +48,10 @@ Header file for HttpLib.
 #define   HTTP_URI_FIELD_USERINFO         5
 #define   HTTP_URI_FIELD_HOST             6
 #define   HTTP_URI_FIELD_PORT             7
 #define   HTTP_URI_FIELD_MAX              8
 
-#define   HTTP_URI_PORT_MIN_NUM           0
 #define   HTTP_URI_PORT_MAX_NUM           65535
 
 //
 // Structure to store the parse result of a HTTP URL.
 //
-- 
1.9.5.msysgit.1



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

* Re: [Patch] MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero
  2017-04-01  0:22 [Patch] MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero Jiaxin Wu
@ 2017-04-01  5:43 ` Zhang, Lubo
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Lubo @ 2017-04-01  5:43 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Bi, Dandan, Ye, Ting, Fu, Siyuan

Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>

-----Original Message-----
From: Wu, Jiaxin 
Sent: Saturday, April 01, 2017 8:22 AM
To: edk2-devel@lists.01.org
Cc: Bi, Dandan <dandan.bi@intel.com>; Zhang, Lubo <lubo.zhang@intel.com>; Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [Patch] MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero

UINTN is unsigned integer, so it's pointless to compare it with zero.

Cc: Bi Dandan <dandan.bi@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 2 +-  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 8e29213..8421caa 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -734,11 +734,11 @@ HttpUrlGetPort (
     Index ++;
   }
 
   Status =  AsciiStrDecimalToUintnS (Url + Parser->FieldData[HTTP_URI_FIELD_PORT].Offset, (CHAR8 **) NULL, &Data);
 
-  if (Data > HTTP_URI_PORT_MAX_NUM || Data < HTTP_URI_PORT_MIN_NUM) {
+  if (Data > HTTP_URI_PORT_MAX_NUM) {
     return EFI_INVALID_PARAMETER;
   }
 
   *Port = (UINT16) Data;
   return Status;
diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
index 5ee0fdc..af82c16 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.h
@@ -48,11 +48,10 @@ Header file for HttpLib.
 #define   HTTP_URI_FIELD_USERINFO         5
 #define   HTTP_URI_FIELD_HOST             6
 #define   HTTP_URI_FIELD_PORT             7
 #define   HTTP_URI_FIELD_MAX              8
 
-#define   HTTP_URI_PORT_MIN_NUM           0
 #define   HTTP_URI_PORT_MAX_NUM           65535
 
 //
 // Structure to store the parse result of a HTTP URL.
 //
--
1.9.5.msysgit.1



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

end of thread, other threads:[~2017-04-01  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-01  0:22 [Patch] MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero Jiaxin Wu
2017-04-01  5:43 ` Zhang, Lubo

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