From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 49B2D2095B06D for ; Thu, 5 Oct 2017 07:58:28 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP; 05 Oct 2017 08:01:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,481,1500966000"; d="scan'208";a="159787039" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga006.fm.intel.com with ESMTP; 05 Oct 2017 08:01:51 -0700 Received: from fmsmsx121.amr.corp.intel.com (10.18.125.36) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 5 Oct 2017 08:01:51 -0700 Received: from fmsmsx103.amr.corp.intel.com ([169.254.2.182]) by fmsmsx121.amr.corp.intel.com ([169.254.6.85]) with mapi id 14.03.0319.002; Thu, 5 Oct 2017 08:01:51 -0700 From: "Carsey, Jaben" To: Meenakshi Aggarwal , "edk2-devel@lists.01.org" , "Wu, Jiaxin" , "Ni, Ruiyu" Thread-Topic: [PATCH] Ifconfig : Fixed False information about Media State. Thread-Index: AQHTPaQIZRmk8nmGw0q9wR7D6IDn/aLVWkXQ Date: Thu, 5 Oct 2017 15:01:50 +0000 Message-ID: References: <1507185391-6076-1-git-send-email-meenakshi.aggarwal@nxp.com> In-Reply-To: <1507185391-6076-1-git-send-email-meenakshi.aggarwal@nxp.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzQ0OTU0ZDktYzZmOC00ZTA0LWI2MzgtNTFjMTMyYThlNTkwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IllBN1I5TFFBZVdmZkVhWVlwdW5BMmEzNXNFcG5lQXM1MUhnK0RkdUJHOFU9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Subject: Re: [PATCH] Ifconfig : Fixed False information about Media State. 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: Thu, 05 Oct 2017 14:58:29 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Is there a reason to move the assignment in the function? I think our codi= ng guidelines specify initialize variables up top. -Jaben > -----Original Message----- > From: Meenakshi Aggarwal [mailto:meenakshi.aggarwal@nxp.com] > Sent: Wednesday, October 04, 2017 11:37 PM > To: edk2-devel@lists.01.org; Wu, Jiaxin ; Carsey, > Jaben ; Ni, Ruiyu > Cc: Meenakshi Aggarwal > Subject: [PATCH] Ifconfig : Fixed False information about Media State. > Importance: High >=20 > Issue : We were setting MediaPresent as TRUE (default), so > even if NetLibDetectMedia() did not set MediaPresent Flag as TRUE, > ifconfig always display Media State as 'Media Present' >=20 > Fix : Set MediaPresent as FALSE before calling NetLibDetectMedia() >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 >=20 > Signed-off-by: Meenakshi Aggarwal > --- > ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > index 4db07b2..7c05b68 100644 > --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c > @@ -554,8 +554,6 @@ IfConfigShowInterfaceInfo ( > EFI_IPv4_ADDRESS Gateway; > UINT32 Index; >=20 > - MediaPresent =3D TRUE; > - > if (IsListEmpty (IfList)) { > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG_INVALID_INTERFACE), gShellNetwork1HiiHandle); > } > @@ -576,6 +574,8 @@ IfConfigShowInterfaceInfo ( > // > // Get Media State. > // > + MediaPresent =3D FALSE; > + > NetLibDetectMedia (IfCb->NicHandle, &MediaPresent); > if (!MediaPresent) { > ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN > (STR_IFCONFIG_INFO_MEDIA_STATE), gShellNetwork1HiiHandle, L"Media > disconnected"); > -- > 2.7.4