From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753469AbbFHVWO (ORCPT ); Mon, 8 Jun 2015 17:22:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58203 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752544AbbFHVWH (ORCPT ); Mon, 8 Jun 2015 17:22:07 -0400 Date: Mon, 8 Jun 2015 14:22:06 -0700 From: Greg Kroah-Hartman To: Laurent Pinchart Cc: Colin King , Felipe Balbi , Sudeep Holla , Valentin Rothberg , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][V3] usb: isp1760: check for null return from kzalloc Message-ID: <20150608212206.GA16448@kroah.com> References: <1433268313-23423-1-git-send-email-colin.king@canonical.com> <2210713.bNgAhNmNaU@avalon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2210713.bNgAhNmNaU@avalon> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 03, 2015 at 03:43:23AM +0300, Laurent Pinchart wrote: > Hi Colin, > > Thank you for the patch. > > On Tuesday 02 June 2015 19:05:13 Colin King wrote: > > From: Colin Ian King > > > > isp1760_ep_alloc_request allocates a structure with kzalloc without checking > > for NULL and then returns a pointer to one of the structure fields. As the > > field happens to be the first in the structure the caller can properly > > check for NULL, but this is risky if the structure layout is changed later. > > Add an explicit NULL check for the kzalloc return value > > > > Detected with smatch static analysis: > > > > drivers/usb/isp1760/isp1760-udc.c:816 isp1760_ep_alloc_request() > > error: potential null dereference 'req'. (kzalloc returns null) > > > > [ thanks to Laurent Pinchart for improved commit message ] > > > > Signed-off-by: Colin Ian King > > Acked-by: Laurent Pinchart > > Felipe, I expect you to pick this up, please let me know if there's any issue. I'll just take it directly, thanks. greg k-h