diff options
author | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-07-31 04:31:27 -0400 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-08-02 04:26:42 -0400 |
commit | 6d29231000bbe0fb9e4893a9c68151ffdd3b5469 (patch) | |
tree | da4fb2f4e05d155430e444678acd270998b713f7 | |
parent | a11bf5ed951f8900d244d09eb03a888b59c7fc82 (diff) |
mtd: nand: Declare tBERS, tR and tPROG as u64 to avoid integer overflow
All timings in nand_sdr_timings are expressed in picoseconds but some
of them may not fit in an u32.
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: 204e7ecd47e2 ("mtd: nand: Add a few more timings to nand_sdr_timings")
Reported-by: Alexander Dahl <ada@thorsis.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Alexander Dahl <ada@thorsis.com>
Tested-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
-rw-r--r-- | drivers/mtd/nand/nand_timings.c | 6 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mtd/nand/nand_timings.c b/drivers/mtd/nand/nand_timings.c index f06312df3669..7e36d7d13c26 100644 --- a/drivers/mtd/nand/nand_timings.c +++ b/drivers/mtd/nand/nand_timings.c | |||
@@ -311,9 +311,9 @@ int onfi_init_data_interface(struct nand_chip *chip, | |||
311 | struct nand_sdr_timings *timings = &iface->timings.sdr; | 311 | struct nand_sdr_timings *timings = &iface->timings.sdr; |
312 | 312 | ||
313 | /* microseconds -> picoseconds */ | 313 | /* microseconds -> picoseconds */ |
314 | timings->tPROG_max = 1000000UL * le16_to_cpu(params->t_prog); | 314 | timings->tPROG_max = 1000000ULL * le16_to_cpu(params->t_prog); |
315 | timings->tBERS_max = 1000000UL * le16_to_cpu(params->t_bers); | 315 | timings->tBERS_max = 1000000ULL * le16_to_cpu(params->t_bers); |
316 | timings->tR_max = 1000000UL * le16_to_cpu(params->t_r); | 316 | timings->tR_max = 1000000ULL * le16_to_cpu(params->t_r); |
317 | 317 | ||
318 | /* nanoseconds -> picoseconds */ | 318 | /* nanoseconds -> picoseconds */ |
319 | timings->tCCS_min = 1000UL * le16_to_cpu(params->t_ccs); | 319 | timings->tCCS_min = 1000UL * le16_to_cpu(params->t_ccs); |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 892148c448cc..5216d2eb2289 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -681,10 +681,10 @@ struct nand_buffers { | |||
681 | * @tWW_min: WP# transition to WE# low | 681 | * @tWW_min: WP# transition to WE# low |
682 | */ | 682 | */ |
683 | struct nand_sdr_timings { | 683 | struct nand_sdr_timings { |
684 | u32 tBERS_max; | 684 | u64 tBERS_max; |
685 | u32 tCCS_min; | 685 | u32 tCCS_min; |
686 | u32 tPROG_max; | 686 | u64 tPROG_max; |
687 | u32 tR_max; | 687 | u64 tR_max; |
688 | u32 tALH_min; | 688 | u32 tALH_min; |
689 | u32 tADL_min; | 689 | u32 tADL_min; |
690 | u32 tALS_min; | 690 | u32 tALS_min; |