From: Sergei Shtylyov <sshtylyov@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation
Date: Mon, 13 Sep 2010 12:52:49 +0400 [thread overview]
Message-ID: <4C8DE661.8030802@mvista.com> (raw)
In-Reply-To: <1284350762-32415-1-git-send-email-leiwen@marvell.com>
Hello.
On 13-09-2010 8:06, Lei Wen wrote:
> Signed-off-by: Lei Wen<leiwen@marvell.com>
> ---
> drivers/mmc/mmc.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index cf4ea16..5ff1c54 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -92,6 +92,11 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
>
> blklen = mmc->write_bl_len;
>
> + if (start > mmc->block_dev.lba || (start + blkcnt) > mmc->block_dev.lba) {
The second comparison should suffice, no? Also, parens are not necessary.
> + puts("operation exceed mmc boundary..\n
> + This devices only have 0x%x blocks\n",
> mmc->block_dev.lba);
Where's the cloging quote? String literals are not broken up like this --
this adds extra spaces to them. Should be:
puts("operation exceed mmc boundary..\n"
"This devices only have 0x%x blocks\n", mmc->block_dev.lba);
> + return 0;
> + }
> err = mmc_set_blocklen(mmc, mmc->write_bl_len);
>
> if (err) {
> @@ -219,6 +224,11 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
> if (!mmc)
> return 0;
>
> + if (start > mmc->block_dev.lba || (start + blkcnt) > mmc->block_dev.lba) {
> + puts("operation exceed mmc boundary..\n
> + This devices only have 0x%x blocks\n", mmc->block_dev.lba);
Same comments here...
WBR, Sergei
next prev parent reply other threads:[~2010-09-13 8:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-13 4:06 [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
2010-09-13 4:06 ` [U-Boot] [PATCH 2/2] mmc: print out avaible partition table Lei Wen
2010-09-13 8:54 ` Sergei Shtylyov
2010-09-13 8:52 ` Sergei Shtylyov [this message]
2010-09-13 9:08 ` [U-Boot] [PATCH 1/2] mmc: add boundary check for mmc operation Lei Wen
-- strict thread matches above, loose matches on Subject: below --
2010-09-13 9:17 Lei Wen
2010-09-13 9:47 ` Wolfgang Denk
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=4C8DE661.8030802@mvista.com \
--to=sshtylyov@mvista.com \
--cc=u-boot@lists.denx.de \
/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