public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: methavanitpong.pipat@socionext.com
Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org,
	michael.d.kinney@intel.com, "Jan Dąbroś" <jsd@semihalf.com>,
	"Marcin Wojtas" <mw@semihalf.com>
Subject: Re: [edk2-platforms] Spi/MvSpiDxe likely NullPtrException
Date: Wed, 13 Sep 2017 09:51:22 +0100	[thread overview]
Message-ID: <20170913085122.daptsucll63pkhdb@bivouac.eciton.net> (raw)
In-Reply-To: <403a5343bcb349abacc4f0a3693dd3e7@SOC-EX03V.e01.socionext.com>

Hi Pipat,

It is useful to prefix emails regarding edk2-platforms with
[edk2-platforms] on the subject line.

+Jan Dąbroś <jsd@semihalf.com> (original author, a fact that has been
lost in the migration from OpenPlatformPkg.
also +Marcin Wojtas <mw@semihalf.com>, 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.
> 


      reply	other threads:[~2017-09-13  8:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-13  0:20 Spi/MvSpiDxe likely NullPtrException methavanitpong.pipat
2017-09-13  8:51 ` Leif Lindholm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170913085122.daptsucll63pkhdb@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox