[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <FC41C24E35F18A40888AACA1A36F3E418ADB557F@fmsmsx115.amr.corp.intel.com>
Date: Tue, 9 Dec 2014 17:35:16 +0000
From: "Nelson, Shannon" <shannon.nelson@...el.com>
To: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
"davem@...emloft.net" <davem@...emloft.net>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"nhorman@...hat.com" <nhorman@...hat.com>,
"sassmann@...hat.com" <sassmann@...hat.com>,
"jogreene@...hat.com" <jogreene@...hat.com>
Subject: RE: [net-next 05/13] i40e: add range check to i40e_aq_rc_to_posix
> -----Original Message-----
> From: Sergei Shtylyov [mailto:sergei.shtylyov@...entembedded.com]
> Sent: Tuesday, December 09, 2014 6:24 AM
> To: Kirsher, Jeffrey T; davem@...emloft.net
> Cc: Nelson, Shannon; netdev@...r.kernel.org; nhorman@...hat.com;
> sassmann@...hat.com; jogreene@...hat.com
> Subject: Re: [net-next 05/13] i40e: add range check to
> i40e_aq_rc_to_posix
>
> Hello.
>
> On 12/9/2014 2:22 PM, Jeff Kirsher wrote:
>
> > From: Shannon Nelson <shannon.nelson@...el.com>
>
> > Just to be sure, add a range check to avoid any possible
> > array index-out-of-bound issues.
>
> > Change-ID: I9323bee6732c2a47599816e1d6c6b3a1f8dcbf54
> > Signed-off-by: Shannon Nelson <shannon.nelson@...el.com>
> > Acked-by: Michal Kosiarz <michal.kosiarz@...el.com>
> > Tested-by: Jim Young <jamesx.m.young@...el.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
> > ---
> > drivers/net/ethernet/intel/i40e/i40e_adminq.h | 2 ++
> > drivers/net/ethernet/intel/i40evf/i40e_adminq.h | 2 ++
> > 2 files changed, 4 insertions(+)
>
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> > index 618fe96..4064b1e 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_adminq.h
> > @@ -136,6 +136,8 @@ static inline int i40e_aq_rc_to_posix(u16 aq_rc)
> > -EFBIG, /* I40E_AQ_RC_EFBIG */
> > };
> >
> > + if (aq_rc >= (sizeof(aq_to_posix) / sizeof((aq_to_posix)[0])))
>
> There's ARRAY_SIZE() macro exactly for such computations. And parens
> around the last 'aq_to_posix' are not needed.
Yep, you're right. I'll see about getting Jeff to push a v2 of this patch soon.
Thanks,
sln
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists