From: <methavanitpong.pipat@socionext.com>
To: <edk2-devel@lists.01.org>
Cc: <ard.biesheuvel@linaro.org>, <leif.lindholm@linaro.org>,
<michael.d.kinney@intel.com>
Subject: Spi/MvSpiDxe likely NullPtrException
Date: Wed, 13 Sep 2017 00:20:33 +0000 [thread overview]
Message-ID: <403a5343bcb349abacc4f0a3693dd3e7@SOC-EX03V.e01.socionext.com> (raw)
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.
next reply other threads:[~2017-09-13 0:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-13 0:20 methavanitpong.pipat [this message]
2017-09-13 8:51 ` [edk2-platforms] Spi/MvSpiDxe likely NullPtrException Leif Lindholm
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=403a5343bcb349abacc4f0a3693dd3e7@SOC-EX03V.e01.socionext.com \
--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