Skip to content

Commit 37c5f9e

Browse files
oocheretmiquelraynal
authored andcommitted
mtd: fix 'part' field data corruption in mtd_info
Commit 46b5889 ("mtd: implement proper partition handling") started using "mtd_get_master_ofs()" in mtd callbacks to determine memory offsets by means of 'part' field from mtd_info, what previously was smashed accessing 'master' field in the mtd_set_dev_defaults() method. That provides wrong offset what causes hardware access errors. Just make 'part', 'master' as separate fields, rather than using union type to avoid 'part' data corruption when mtd_set_dev_defaults() is called. Fixes: 46b5889 ("mtd: implement proper partition handling") Signed-off-by: Oleksandr Ocheretnyi <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 084c16a commit 37c5f9e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

include/linux/mtd/mtd.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,8 @@ struct mtd_info {
389389
/* List of partitions attached to this MTD device */
390390
struct list_head partitions;
391391

392-
union {
393-
struct mtd_part part;
394-
struct mtd_master master;
395-
};
392+
struct mtd_part part;
393+
struct mtd_master master;
396394
};
397395

398396
static inline struct mtd_info *mtd_get_master(struct mtd_info *mtd)

0 commit comments

Comments
 (0)