From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5BD9F21A04804 for ; Fri, 31 Mar 2017 17:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491006125; x=1522542125; h=from:to:cc:subject:date:message-id; bh=nf+YUq0V3ywAQ79SrOycAwo95VwtRPYtgabJcnYpFKU=; b=KIBFishkQiks8fSJ3Hw6YcRbYKLGbEu3rOpz7eriwfZCTEfa5F9By6h/ Lalz6L6/+GvSjgCUnu+iPoHyUfZE6w==; Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Mar 2017 17:22:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,254,1486454400"; d="scan'208";a="72400917" Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.41]) by orsmga004.jf.intel.com with ESMTP; 31 Mar 2017 17:22:03 -0700 From: Jiaxin Wu To: edk2-devel@lists.01.org Cc: Bi Dandan , Zhang Lubo , Ye Ting , Fu Siyuan , Wu Jiaxin Date: Sat, 1 Apr 2017 08:22:02 +0800 Message-Id: <1491006122-5416-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [Patch] MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Apr 2017 00:22:04 -0000 UINTN is unsigned integer, so it's pointless to compare it with zero. Cc: Bi Dandan Cc: Zhang Lubo Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- 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