From: Brian Norris <computersforpeace@gmail.com>
To: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: r852: make ecc_reg 32-bit in r852_ecc_correct
Date: Mon, 20 Jul 2015 10:39:01 -0700 [thread overview]
Message-ID: <20150720173901.GC24125@google.com> (raw)
In-Reply-To: <1436061461-30560-1-git-send-email-nicolas.iooss_linux@m4x.org>
On Sun, Jul 05, 2015 at 09:57:41AM +0800, Nicolas Iooss wrote:
> r852_ecc_correct() reads a 32-bit register into a 16-bit variable,
> ecc_reg, but this variable is later used as if it was larger. This is
> reported by clang when building the kernel with many warnings:
>
> drivers/mtd/nand/r852.c:512:11: error: shift count >= width of type
> [-Werror,-Wshift-count-overflow]
> ecc_reg >>= 16;
> ^ ~~
> Fix this by making ecc_reg 32-bit, like the return type of
> r852_read_reg_dword().
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
> ---
>
> As I haven't got the hardware to test this patch, it is only compile-tested.
Looks good to me. Pushed to l2-mtd.git.
Thanks,
Brian
> drivers/mtd/nand/r852.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/r852.c b/drivers/mtd/nand/r852.c
> index 77e96d2df96c..cc6bac537f5a 100644
> --- a/drivers/mtd/nand/r852.c
> +++ b/drivers/mtd/nand/r852.c
> @@ -466,7 +466,7 @@ static int r852_ecc_calculate(struct mtd_info *mtd, const uint8_t *dat,
> static int r852_ecc_correct(struct mtd_info *mtd, uint8_t *dat,
> uint8_t *read_ecc, uint8_t *calc_ecc)
> {
> - uint16_t ecc_reg;
> + uint32_t ecc_reg;
> uint8_t ecc_status, err_byte;
> int i, error = 0;
>
> --
> 2.4.5
>
prev parent reply other threads:[~2015-07-20 17:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-05 1:57 Nicolas Iooss
2015-07-20 17:39 ` Brian Norris [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-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=20150720173901.GC24125@google.com \
--to=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=maximlevitsky@gmail.com \
--cc=nicolas.iooss_linux@m4x.org \
/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