Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759571AbaGCSpW (ORCPT ); Thu, 3 Jul 2014 14:45:22 -0400 Received: from mail-oa0-f47.google.com ([209.85.219.47]:50753 "EHLO mail-oa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759435AbaGCSpU (ORCPT ); Thu, 3 Jul 2014 14:45:20 -0400 MIME-Version: 1.0 In-Reply-To: References: <1400429439-11184-1-git-send-email-rickard_strandqvist@spectrumdigital.se> <20140528112628.GB11953@infradead.org> Date: Thu, 3 Jul 2014 20:45:18 +0200 Message-ID: Subject: Re: [PATCH] scsi: mpt2sas: mpt2sas_base.c: Fix for possible null pointer dereference From: Rickard Strandqvist To: Joe Lawrence Cc: Christoph Hellwig , Nagalakshmi Nandigama , Sreekanth Reddy , support@lsi.com, "James E.J. Bottomley" , DL-MPTFusionLinux@lsi.com, linux-scsi@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2014-07-03 19:45 GMT+02:00 Joe Lawrence : > On Wed, 28 May 2014, Christoph Hellwig wrote: > >> > - ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK; >> > + if (mpi_reply) { >> > + ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK; >> > + } >> > >> > if (ioc_status != MPI2_IOCSTATUS_SUCCESS) >> > ioc->port_enable_failed = 1; >> >> ioc_status isn't initialized without the reply and used here as well >> as later in the function. I think we'll need input from LSI or others >> with the spec on what to do when we didn't get a reply. > > Any update on this? > > The mpt3 version checks for !mpi_reply and returns 1. Which leads to > another question -- should mpt{2,3}sas_port_enable_done ever return 0 (as their > respective comments describe)? > > Regards, > > -- Joe Hi Good questions Joe! And good someone else brought this up, because I guess it's not meant to me. And it looks however now that I've done quite a few more patches that there should not have been any {} And then, it is perhaps good to sett a start value for ioc_status. My suggestion is: u16 ioc_status = MPI2_IOCSTATUS_OP_STATE_NOT_SUPPORTED; Kind regards Rickard Strandqvist -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/