From: Robert Jarzmik <robert.jarzmik@free.fr>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] mtd mtdraw: Fix partial page read
Date: Sun, 16 Sep 2012 10:46:54 +0200 [thread overview]
Message-ID: <87k3vuuzgh.fsf@free.fr> (raw)
In-Reply-To: <1347720962-32574-1-git-send-email-s.hauer@pengutronix.de> (Sascha Hauer's message of "Sat, 15 Sep 2012 16:56:02 +0200")
Sascha Hauer <s.hauer@pengutronix.de> writes:
> When reading parts of a page we have to limit the maximum bytes copied
> the the remaining bytes of a page.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Robert Jarzmik <robert.jarzmik@free.fr>
> ---
> drivers/mtd/mtdraw.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
> index d28ae07..29f6a8c 100644
> --- a/drivers/mtd/mtdraw.c
> +++ b/drivers/mtd/mtdraw.c
> @@ -129,6 +129,7 @@ static ssize_t mtdraw_read(struct cdev *cdev, void *buf, size_t count,
>
> while (ret > 0 && count > 0) {
> toread = min_t(int, count, mtd->writesize + mtd->oobsize);
> + toread = min_t(int, toread, mtd->writesize + mtd->oobsize -
> skip);
Hi Sasha,
Why the 2 lines of min_t() instead of a single:
toread = min_t(int, count, mtd->writesize + mtd->oobsize - skip)
Cheers.
--
Robert
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-09-16 8:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-15 14:56 Sascha Hauer
2012-09-16 8:46 ` Robert Jarzmik [this message]
2012-09-16 8:58 ` Sascha Hauer
2012-09-16 19:44 ` Robert Jarzmik
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=87k3vuuzgh.fsf@free.fr \
--to=robert.jarzmik@free.fr \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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