Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758636AbcDHPVJ (ORCPT ); Fri, 8 Apr 2016 11:21:09 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:37014 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1758360AbcDHPVG (ORCPT ); Fri, 8 Apr 2016 11:21:06 -0400 Date: Fri, 8 Apr 2016 11:21:05 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Greg Kroah-Hartman cc: Chunfeng Yun , , , , Subject: Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence In-Reply-To: <20160408140701.GA3547@kroah.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 580 Lines: 17 On Fri, 8 Apr 2016, Greg Kroah-Hartman wrote: > On Fri, Apr 08, 2016 at 05:08:03PM +0800, Chunfeng Yun wrote: > > NULL pointer dereferrence will happen when class driver > > wants to allocate zero length buffer and pool_max[0] > > can't be used, so skip reserved pool in this case. > > Why would a driver want to allocate a 0 length buffer? What driver does > this? > > Shouldn't we fix that issue instead? And even if a driver does want to allocate a 0-length buffer, shouldn't the function simply return early instead of running through all its calculations? Alan Stern