Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935480AbcLTObv (ORCPT ); Tue, 20 Dec 2016 09:31:51 -0500 Received: from resqmta-po-05v.sys.comcast.net ([96.114.154.164]:52631 "EHLO resqmta-po-05v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935254AbcLTObs (ORCPT ); Tue, 20 Dec 2016 09:31:48 -0500 Reply-To: shuah@kernel.org Subject: Re: [PATCH] usbip: vudc: check for NULL before use References: <1482101091-3969-1-git-send-email-sudipm.mukherjee@gmail.com> To: Sudip Mukherjee , Valentina Manea , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Shuah Khan , Shuah Khan From: Shuah Khan Message-ID: Date: Tue, 20 Dec 2016 07:31:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1482101091-3969-1-git-send-email-sudipm.mukherjee@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfFfzH4zZA5/sFEJ/BoInpnB4bz9TSn+bGrABbvbpNUqHwGgSWL6ex4koDmsMc8tB2J3CgoWx7YLQi7j5xXIqTZBQ2YM/8PUgXdxLJx+vdayt86VzgHcZ 0E9kftHulweNAOFi3kRdk43CARYnQ/iE0Jg85FLvJeEVrTcLOWj7n4bmInv9hqs4naSEoaD08iTlyIuH1EvNb72wEanfYHbjWljCdyrrspeI74ioUMm8YqnW qTYCNhlUeYAKGMiRfme38yfKw0jW5FRnYCZjDZTt39bySQIL7z1lG8uoOs3axL0JGaILLTaabNRoXHY1/Pf8m+3P2EezHq61EeLLvVLNr23fErcNiP+FT1cl yza5vFcoTdnwCMEsZDhfWduXgn2hh01AjEI34HwCQXJ98oTqm4o= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 907 Lines: 33 On 12/18/2016 03:44 PM, Sudip Mukherjee wrote: > to_vep() is doing a container_of() on _ep. It is better to do the NULL > check first and then use it. > > Signed-off-by: Sudip Mukherjee > --- > drivers/usb/usbip/vudc_dev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/usbip/vudc_dev.c b/drivers/usb/usbip/vudc_dev.c > index 968471b..32ea604 100644 > --- a/drivers/usb/usbip/vudc_dev.c > +++ b/drivers/usb/usbip/vudc_dev.c > @@ -388,10 +388,10 @@ static int vep_dequeue(struct usb_ep *_ep, struct usb_request *_req) > unsigned long flags; > int ret = 0; > > - ep = to_vep(_ep); > if (!_ep) > return -EINVAL; Hmm. Linus's latest checks _ep and _req. Are you sure you are working with the latest tree? > > + ep = to_vep(_ep); > udc = ep_to_vudc(ep); > if (!udc->driver) > return -ESHUTDOWN; > thanks, -- Shuah