From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Fri, 25 May 2018 13:21:57 +0000 Subject: Re: [PATCH v2] media: davinci vpbe: array underflow in vpbe_enum_outputs() Message-Id: <20180525132157.rx3fuvzytpsuysft@mwanda> List-Id: References: <20180525131239.45exrwgxr2f3kb57@kili.mountain> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Hans Verkuil Cc: "Lad, Prabhakar" , Manjunath Hadli , Mauro Carvalho Chehab , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org On Fri, May 25, 2018 at 03:16:21PM +0200, Hans Verkuil wrote: > On 25/05/18 15:12, Dan Carpenter wrote: > > In vpbe_enum_outputs() we check if (temp_index >= cfg->num_outputs) but > > the problem is that temp_index can be negative. I've made > > cgf->num_outputs unsigned to fix this issue. > > Shouldn't temp_index also be made unsigned? It certainly would make a lot of > sense to do that. Yeah, sure. It doesn't make any difference in terms of runtime but it's probably cleaner. regards, dan carpenter