From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 36C305688 for ; Thu, 22 Sep 2016 18:08:13 +0200 (CEST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP; 22 Sep 2016 09:08:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,378,1470726000"; d="scan'208";a="12095868" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 22 Sep 2016 09:08:11 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 22 Sep 2016 09:08:10 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 22 Sep 2016 09:08:10 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.118]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.101]) with mapi id 14.03.0248.002; Fri, 23 Sep 2016 00:08:09 +0800 From: "Wang, Xiao W" To: "Yigit, Ferruh" , "Lu, Wenzhuo" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions Thread-Index: AQHSAHqYkjUmHPtic0moMhDe0ze6P6CAqUiAgAUqm7A= Date: Thu, 22 Sep 2016 16:08:08 +0000 Message-ID: References: <1472312902-16963-1-git-send-email-xiao.w.wang@intel.com> <1472312902-16963-24-git-send-email-xiao.w.wang@intel.com> <6968dbf3-b814-b70f-26d9-0daf3d1d0126@intel.com> In-Reply-To: <6968dbf3-b814-b70f-26d9-0daf3d1d0126@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_PUBLIC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYjFiNTNjZTctNTkwYi00NTgxLWE5YmMtMjkwYTM4MWQyMTI4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX1BVQkxJQyJ9XX1dfSwiU3ViamVjdExhYmVscyI6W10sIlRNQ1ZlcnNpb24iOiIxNS45LjYuNiIsIlRydXN0ZWRMYWJlbEhhc2giOiJNYzEzbUxmSWxOUGdjeVg3ZGN4N1wvallCT09BNExkVnhLN09SVlwvUjhuV0E9In0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in LED functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Sep 2016 16:08:13 -0000 Hi Ferruh, > -----Original Message----- > From: Yigit, Ferruh > Sent: Tuesday, September 20, 2016 1:07 AM > To: Wang, Xiao W ; Lu, Wenzhuo > > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 23/39] net/ixgbe/base: add bound check in = LED > functions >=20 > On 8/27/2016 4:48 PM, Xiao Wang wrote: > > Do parameter check to prevent exceptional value being written into > > register. > > > > Signed-off-by: Xiao Wang > > --- > > drivers/net/ixgbe/base/ixgbe_common.c | 15 ++++++++++++++- > > drivers/net/ixgbe/base/ixgbe_x540.c | 6 ++++++ > > 2 files changed, 20 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/net/ixgbe/base/ixgbe_common.c > b/drivers/net/ixgbe/base/ixgbe_common.c > > index 1c7263d..3c3272e 100644 > > --- a/drivers/net/ixgbe/base/ixgbe_common.c > > +++ b/drivers/net/ixgbe/base/ixgbe_common.c > > @@ -1133,6 +1133,9 @@ s32 ixgbe_led_on_generic(struct ixgbe_hw *hw, > u32 index) > > > > DEBUGFUNC("ixgbe_led_on_generic"); > > > > + if (index > 3) >=20 > What about using macro for hardcoded value 3. For the base (shared) code update, we'd better to keep DPDK in consistency with kernel driver. >=20 > > + return IXGBE_ERR_PARAM; > > + > > /* To turn on the LED, set mode to ON. */ > > led_reg &=3D ~IXGBE_LED_MODE_MASK(index); > > led_reg |=3D IXGBE_LED_ON << IXGBE_LED_MODE_SHIFT(index); > > @@ -1153,6 +1156,9 @@ s32 ixgbe_led_off_generic(struct ixgbe_hw *hw, > u32 index) > > > > DEBUGFUNC("ixgbe_led_off_generic"); > > > > + if (index > 3) > > + return IXGBE_ERR_PARAM; > > + > > /* To turn off the LED, set mode to OFF. */ > > led_reg &=3D ~IXGBE_LED_MODE_MASK(index); > > led_reg |=3D IXGBE_LED_OFF << IXGBE_LED_MODE_SHIFT(index); > > @@ -3341,7 +3347,7 @@ s32 prot_autoc_write_generic(struct ixgbe_hw > *hw, u32 reg_val, bool locked) > > **/ > > s32 ixgbe_enable_sec_rx_path_generic(struct ixgbe_hw *hw) > > { > > - int secrxreg; > > + u32 secrxreg; >=20 > This modification seems unrelated with the patch. Will put such minor change into a cleanup patch. >=20 > > >=20