From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x22b.google.com (mail-wr0-x22b.google.com [IPv6:2a00:1450:400c:c0c::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C3B0C208F7AD7 for ; Wed, 13 Sep 2017 01:48:28 -0700 (PDT) Received: by mail-wr0-x22b.google.com with SMTP id m18so27250687wrm.2 for ; Wed, 13 Sep 2017 01:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=dTMAh3CzcpC1F9jl1CzCqBn+YKPEQedt5x57B9mT5K8=; b=Xh8durRUMVr9KuvnD5D/J++W3pLksbEMNTNsgwsvH7d0OdIToc7dYfB92/TEbgcMgq Zm3py8vkwenUtxdo/pkeTf9ZfHobSwMb5qmmnuvT6WEzm7TGQ8as/Xh9ljvmb9zy/CVJ 0OYqYrtZ/kKAGIuECIiLrntVIZEMGpKQ5gQWY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=dTMAh3CzcpC1F9jl1CzCqBn+YKPEQedt5x57B9mT5K8=; b=nwh9y1OCwh3gui0CPrBtYRNbml5CgegVZQkLpJwys/FgsH8JK+MEnnrSFZGgFiHpPv rWAdiD41ujY3nAUuU1OXJX1AoyOUBdAaEJcrBG2ARSsx1P5sdFAv5KMDvuSwrMsbGNfI in3J3Oq+DFQZXjZgaVjgwtrnnvlRZ4BXSfnkWRZzC5eHJoWnh7kw6+zxdQUZnpv6ocQX JQsGYe88fuLK0b6m8ppyABUC6zXzR40G24Q1vHp1YvrO5AwRLFX0gkNa50yzAn01MGob 51p4/yNyZjKOhtQbj3TwV6UahHFlTw4jj8oD8/CFVaPpdlOL1o6dFqnVb0Gkrjwl0NsQ jiaA== X-Gm-Message-State: AHPjjUj4XA6x9wSLJNIR2VIF14fU3oP9MEVzkLNx2nU6WtA2H7OpSKKp q5QNu6VPH+8iKCiE X-Google-Smtp-Source: ADKCNb633Ywse8vcU+htUQcmaY0CqnhyWZspNRR0zAZN/Uvb77iamBYEZSmUcNvg4/0JHf44Wh+ung== X-Received: by 10.223.139.200 with SMTP id w8mr16960495wra.172.1505292684580; Wed, 13 Sep 2017 01:51:24 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id w204sm628849wmw.32.2017.09.13.01.51.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Sep 2017 01:51:23 -0700 (PDT) Date: Wed, 13 Sep 2017 09:51:22 +0100 From: Leif Lindholm To: methavanitpong.pipat@socionext.com Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, Jan =?utf-8?B?RMSFYnJvxZs=?= , Marcin Wojtas Message-ID: <20170913085122.daptsucll63pkhdb@bivouac.eciton.net> References: <403a5343bcb349abacc4f0a3693dd3e7@SOC-EX03V.e01.socionext.com> MIME-Version: 1.0 In-Reply-To: <403a5343bcb349abacc4f0a3693dd3e7@SOC-EX03V.e01.socionext.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [edk2-platforms] Spi/MvSpiDxe likely NullPtrException X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Sep 2017 08:48:29 -0000 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi Pipat, It is useful to prefix emails regarding edk2-platforms with [edk2-platforms] on the subject line. +Jan Dąbroś (original author, a fact that has been lost in the migration from OpenPlatformPkg. also +Marcin Wojtas , Marvell platform owner. (Neither of which are obvious from looking at the source tree.) / Leif On Wed, Sep 13, 2017 at 12:20:33AM +0000, methavanitpong.pipat@socionext.com wrote: > Hi, > > MvSpiDxe.c:MvSpiTransfer() attempts load data into DataInPtr, which is > a possibly NULL pointer. > > https://github.com/tianocore/edk2-platforms/blob/master/Platform/Marvell/Drivers/Spi/MvSpiDxe.c#L228 > ///////////// SNIP ///////////// > for (Iterator = 0; Iterator < SPI_TIMEOUT; Iterator++) { > if (MmioRead32 (SpiRegBase + SPI_INT_CAUSE_REG)) { > *DataInPtr = MmioRead32 (SpiRegBase + SPI_DATA_IN_REG); > //////////////////////////////// > > One example that DataInPtr == NULL is in MvSpiDxe.c:MvReadWrite() in > the first MvSpiTransfer() call. > > https://github.com/tianocore/edk2-platforms/blob/master/Platform/Marvell/Drivers/Spi/MvSpiDxe.c#L276 > ///////////// SNIP ///////////// > Status = MvSpiTransfer (This, Slave, CmdSize, Cmd, NULL, SPI_TRANSFER_BEGIN); > if (EFI_ERROR (Status)) { > Print (L"Spi Transfer Error\n"); > return EFI_DEVICE_ERROR; > } > > Status = MvSpiTransfer (This, Slave, DataSize, DataOut, DataIn, SPI_TRANSFER_END); > if (EFI_ERROR (Status)) { > Print (L"Spi Transfer Error\n"); > return EFI_DEVICE_ERROR; > } > //////////////////////////////// > > It should store data from SPI_DATA_IN_REG in a temporary variable first, > then passes the data into DataInPtr if DataInPtr != NULL. > -- > Pipat Methavanitpong > Software Developer, S-Project 3 > Socionext Inc. >