[PATCH 5/7] mtd: nand-mxs: fix out-of-bounds write on 64-bit SoCs
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Sep 28 11:42:45 EDT 2020
Probing the nand_mxs device driver on 64 bit systems invokes
undefined behavior, because of an errant cast. Fix this.
No change of behavior for 32-bit SoCs intended.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/mtd/nand/nand_mxs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 36b6e7ac224e..e2b6e2162076 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -2145,9 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev)
if (mxs_nand_mtd)
return -EBUSY;
- err = dev_get_drvdata(dev, (const void **)&type);
- if (err)
- type = GPMI_MXS;
+ type = (enum gpmi_type)device_get_match_data(dev);
nand_info = kzalloc(sizeof(struct mxs_nand_info), GFP_KERNEL);
if (!nand_info) {
--
2.28.0
More information about the barebox
mailing list