From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH] megaraid: add scsi_cmnd NULL check before use Date: Thu, 12 May 2016 09:35:19 +0300 Message-ID: <20160512062948.GG19274@mwanda> References: <1462668011.32105.7.camel@petros-ultrathin> <20160509080551.GH29510@mwanda> <3aced88f2434c8dd0a8aa4fd902445a9@mail.gmail.com> <1462829338.1873.4.camel@petroskoutoupis.com> <166e07c6f96724c0d1f972f2a65d0a65@mail.gmail.com> <1463017791.5827.4.camel@petros-ultrathin> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from aserp1040.oracle.com ([141.146.126.69]:46919 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751450AbcELGjo (ORCPT ); Thu, 12 May 2016 02:39:44 -0400 Content-Disposition: inline In-Reply-To: <1463017791.5827.4.camel@petros-ultrathin> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Petros Koutoupis Cc: Sumit Saxena , Finn Thain , kashyap.desai@avagotech.com, sumit.saxena@avagotech.com, uday.lingala@avagotech.com, megaraidlinux.pdl@avagotech.com, linux-scsi@vger.kernel.org On Wed, May 11, 2016 at 08:49:51PM -0500, Petros Koutoupis wrote: > Sumit, > > I will resubmit the patch with all the recommendations. Thank you. In case > you are interested, I have a crash file showcasing the error. I can always > provide this outside of this mailing thread. > Please send it to the thread. To be honest, I totally can't understand this thread. Sumit says it is impossible and you are saying that you have seen it happen in real life. Are you using out of tree code or something? What are you doing that is unexpected? I don't see the point of adding a WARN_ON(). NULL derefs normally generate a pretty clear stack trace already (unless they are caused by memory corruption). Why are we not just fixing the bugs instead of warning and then crashing. Also when I'm doing static analysis people always tell me that "that bug is impossible, trust me." and instead of trusting people I really wish they would just show me the relevant code that prevents it from happening. regards, dan carpenter