From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Fri, 20 Jul 2012 14:35:25 +0000 Subject: Re: [patch] drm/radeon: check for allocation failure in radeon_ring_backup() Message-Id: <20120720143525.GE16291@mwanda> List-Id: References: <20120720111700.GB22245@elgon.mountain> <500960F8.6060906@vodafone.de> In-Reply-To: <500960F8.6060906@vodafone.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: kernel-janitors@vger.kernel.org, Michel =?iso-8859-1?Q?D=E4nzer?= , dri-devel@lists.freedesktop.org, Jerome Glisse , Alex Deucher , Dave Airlie On Fri, Jul 20, 2012 at 03:45:28PM +0200, Christian K=F6nig wrote: > On 20.07.2012 13:17, Dan Carpenter wrote: > >Static checkers complain if this we don't check for allocation failure. > >Also we can use the new kmalloc_array() function here as a cleanup. > > > >Signed-off-by: Dan Carpenter > What's the benefit of using kmalloc_array instead of just kmalloc? >=20 It has built in integer overflow protection. Whenever I see multiplication in kmalloc(), I automatically start to audit for overflows, but now, ha ha, just change it to kmalloc_array() and forget about it. (There weren't any integer overflow problems in the original code, btw). regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [patch] drm/radeon: check for allocation failure in radeon_ring_backup() Date: Fri, 20 Jul 2012 17:35:25 +0300 Message-ID: <20120720143525.GE16291@mwanda> References: <20120720111700.GB22245@elgon.mountain> <500960F8.6060906@vodafone.de> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by gabe.freedesktop.org (Postfix) with ESMTP id 402FC9E801 for ; Fri, 20 Jul 2012 07:35:43 -0700 (PDT) Content-Disposition: inline In-Reply-To: <500960F8.6060906@vodafone.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: kernel-janitors@vger.kernel.org, Michel =?iso-8859-1?Q?D=E4nzer?= , dri-devel@lists.freedesktop.org, Jerome Glisse , Alex Deucher , Dave Airlie List-Id: dri-devel@lists.freedesktop.org On Fri, Jul 20, 2012 at 03:45:28PM +0200, Christian K=F6nig wrote: > On 20.07.2012 13:17, Dan Carpenter wrote: > >Static checkers complain if this we don't check for allocation failure. > >Also we can use the new kmalloc_array() function here as a cleanup. > > > >Signed-off-by: Dan Carpenter > What's the benefit of using kmalloc_array instead of just kmalloc? > = It has built in integer overflow protection. Whenever I see multiplication in kmalloc(), I automatically start to audit for overflows, but now, ha ha, just change it to kmalloc_array() and forget about it. (There weren't any integer overflow problems in the original code, btw). regards, dan carpenter