From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Thu, 07 Aug 2014 15:56:30 +0000 Subject: Re: [patch] drm/radeon: add a check for allocation failure Message-Id: <20140807155630.GD11899@mwanda> List-Id: References: <20140807152736.GA10299@mwanda> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alex Deucher Cc: Alex Deucher , kernel-janitors@vger.kernel.org, Christian =?iso-8859-1?Q?K=F6nig?= , Maling list - DRI developers On Thu, Aug 07, 2014 at 11:31:15AM -0400, Alex Deucher wrote: > On Thu, Aug 7, 2014 at 11:27 AM, Dan Carpenter wrote: > > We can easily return -ENOMEM here if kzalloc() fails. > > > > Signed-off-by: Dan Carpenter > > > > diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c > > index ccae4d9..d15d987 100644 > > --- a/drivers/gpu/drm/radeon/radeon_vm.c > > +++ b/drivers/gpu/drm/radeon/radeon_vm.c > > @@ -483,6 +483,8 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, > > /* add a clone of the bo_va to clear the old address */ > > struct radeon_bo_va *tmp; > > tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); > > + if (!tmp) > > + return -ENOMEM; > > We need to drop the lock here too. I'll apply and fix it up. Thanks! > Gar. I'm sorry. I thought it looked easier than it was. Also I really should have caught that in my qc. :/ I'm not sure what happened. regards, dan carpenter From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [patch] drm/radeon: add a check for allocation failure Date: Thu, 7 Aug 2014 18:56:30 +0300 Message-ID: <20140807155630.GD11899@mwanda> References: <20140807152736.GA10299@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by gabe.freedesktop.org (Postfix) with ESMTP id E17496E624 for ; Thu, 7 Aug 2014 08:56:40 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Alex Deucher Cc: Alex Deucher , kernel-janitors@vger.kernel.org, Christian =?iso-8859-1?Q?K=F6nig?= , Maling list - DRI developers List-Id: dri-devel@lists.freedesktop.org On Thu, Aug 07, 2014 at 11:31:15AM -0400, Alex Deucher wrote: > On Thu, Aug 7, 2014 at 11:27 AM, Dan Carpenter wrote: > > We can easily return -ENOMEM here if kzalloc() fails. > > > > Signed-off-by: Dan Carpenter > > > > diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c > > index ccae4d9..d15d987 100644 > > --- a/drivers/gpu/drm/radeon/radeon_vm.c > > +++ b/drivers/gpu/drm/radeon/radeon_vm.c > > @@ -483,6 +483,8 @@ int radeon_vm_bo_set_addr(struct radeon_device *rdev, > > /* add a clone of the bo_va to clear the old address */ > > struct radeon_bo_va *tmp; > > tmp = kzalloc(sizeof(struct radeon_bo_va), GFP_KERNEL); > > + if (!tmp) > > + return -ENOMEM; > > We need to drop the lock here too. I'll apply and fix it up. Thanks! > Gar. I'm sorry. I thought it looked easier than it was. Also I really should have caught that in my qc. :/ I'm not sure what happened. regards, dan carpenter