From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754980AbbDTIfO (ORCPT ); Mon, 20 Apr 2015 04:35:14 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:19471 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754738AbbDTIdW (ORCPT ); Mon, 20 Apr 2015 04:33:22 -0400 Date: Mon, 20 Apr 2015 11:33:10 +0300 From: Dan Carpenter To: Joe Perches Cc: Yorick Rommers , devel@driverdev.osuosl.org, lidza.louina@gmail.com, driverdev-devel@linuxdriverproject.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org Subject: Re: [PATCH] Staging: dgnc: Using temporary value for repeated dereferences. Message-ID: <20150420083310.GE16501@mwanda> References: <1429475676.2947.43.camel@perches.com> <1429491259.27863.1.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429491259.27863.1.camel@perches.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 19, 2015 at 05:54:19PM -0700, Joe Perches wrote: > > diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c > > index b13318a..0437117 100644 > > --- a/drivers/staging/dgnc/dgnc_mgmt.c > > +++ b/drivers/staging/dgnc/dgnc_mgmt.c > > @@ -131,6 +131,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > > int brd; > > > > struct digi_info di; > > + struct dgnc_board *bd = dgnc_Board[brd]; > > Please read the code. > brd is got from userspace and you've dereferenced > it before getting the value from userspace. Gar. Oops. I totally missed that when I looked at this patch. :( You would hope that GCC would warn about the uninitialized variable but it doesn't. regards, dan carpenter