From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754204AbcHAQJ3 (ORCPT ); Mon, 1 Aug 2016 12:09:29 -0400 Received: from fldsmtpe02.verizon.com ([140.108.26.141]:4280 "EHLO fldsmtpe02.verizon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754065AbcHAQJY (ORCPT ); Mon, 1 Aug 2016 12:09:24 -0400 X-Greylist: delayed 387 seconds by postgrey-1.27 at vger.kernel.org; Mon, 01 Aug 2016 12:09:24 EDT X-IronPort-Anti-Spam-Filtered: false From: "Levin, Alexander" To: Sunil Kovvuri , "Levin, Alexander" X-IronPort-AV: E=Sophos;i="5.28,455,1464652800"; d="scan'208";a="176591397" CC: "sgoutham@cavium.com" , "rric@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Date: Mon, 1 Aug 2016 11:57:58 -0400 Subject: Re: [PATCH] net: thunderx: correct bound check in nic_config_loopback Thread-Topic: [PATCH] net: thunderx: correct bound check in nic_config_loopback Thread-Index: AdHsDXgghXXC9Ma7SnqmrByFfyNHVw== Message-ID: <6b86fd8a-e97a-8b71-1786-50aa9e667873@verizon.com> References: <1469933384-16827-1-git-send-email-alexander.levin@verizon.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 acceptlanguage: en-US Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u71G9YnG015404 On 07/31/2016 12:41 PM, Sunil Kovvuri wrote: > Thanks for finding. > A much better fix would be, > > - if (lbk->vf_id > MAX_LMAC) > + if (lbk->vf_id >= nic->num_vf_en) > return -1; > > where 'num_vf_en' reflects the exact number of physical interfaces or > LMACs on the system. Right. I see quite a few more places that compare to MAX_LMAC vs num_vf_en. What was the reasoning behind it then? Thanks, Sasha