summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdoops.c
diff options
context:
space:
mode:
authorJean-Marc Eurin <jmeurin@google.com>2022-04-22 02:42:42 +0300
committerMiquel Raynal <miquel.raynal@bootlin.com>2022-04-26 10:27:05 +0300
commitfbb83e546ea4543ab0c59dcbfc5a5a1471ea1806 (patch)
treec1f1dea1100e43c817ba3d8a5dd3534f82c914e8 /drivers/mtd/mtdoops.c
parent96a3295c351da82d7af99b2fc004a3cf9f4716a9 (diff)
downloadlinux-fbb83e546ea4543ab0c59dcbfc5a5a1471ea1806.tar.xz
mtd: mtdoops: Fix the size of the header read buffer.
The read buffer size depends on the MTDOOPS_HEADER_SIZE. Tested: Changed the header size, it doesn't panic, header is still read/written correctly. Signed-off-by: Jean-Marc Eurin <jmeurin@google.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220421234244.2172003-2-jmeurin@google.com
Diffstat (limited to 'drivers/mtd/mtdoops.c')
-rw-r--r--drivers/mtd/mtdoops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 227df24387df..09a26747f490 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -223,7 +223,7 @@ static void find_next_position(struct mtdoops_context *cxt)
{
struct mtd_info *mtd = cxt->mtd;
int ret, page, maxpos = 0;
- u32 count[2], maxcount = 0xffffffff;
+ u32 count[MTDOOPS_HEADER_SIZE/sizeof(u32)], maxcount = 0xffffffff;
size_t retlen;
for (page = 0; page < cxt->oops_pages; page++) {