From: Mark Brown <broonie@kernel.org>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "open list:SPI SUBSYSTEM" <linux-spi@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH for-next] spi: bcm53xx: add spi_flash_read callback for MMIO-based reads
Date: Mon, 18 Apr 2016 12:24:57 +0100 [thread overview]
Message-ID: <20160418112457.GU3217@sirena.org.uk> (raw)
In-Reply-To: <1460977843-9426-1-git-send-email-zajec5@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 727 bytes --]
On Mon, Apr 18, 2016 at 01:10:43PM +0200, Rafał Miłecki wrote:
> +static int bcm53xxspi_flash_read(struct spi_device *spi,
> + struct spi_flash_read_message *msg)
> +{
> + struct bcm53xxspi *b53spi = spi_master_get_devdata(spi->master);
> + int ret = 0;
> +
> + bcm53xxspi_enable_bspi(b53spi);
> + memcpy_fromio(msg->buf, b53spi->mmio_base + msg->from, msg->len);
> + msg->retlen = msg->len;
There's no bounds check here but...
> + if (core->addr_s[0])
> + b53spi->mmio_base = devm_ioremap(dev, core->addr_s[0], SZ_32M);
...we only mapped 32M here. What if something tries to do a larger
read? It's also a bit surprising that we're mapping a specific size
here rather than the entire resource.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-04-18 11:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 11:10 Rafał Miłecki
2016-04-18 11:24 ` Mark Brown [this message]
2016-04-18 11:38 ` Rafał Miłecki
2016-04-18 11:57 ` Mark Brown
2016-04-18 13:48 ` Vignesh R
2016-04-18 12:39 ` [PATCH V2 " Rafał Miłecki
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-all 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=20160418112457.GU3217@sirena.org.uk \
--to=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=zajec5@gmail.com \
/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
Powered by JetHome