[PATCH 4/7] aiodev: lm75: fix out-of-bounds write on 64-bit SoCs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Probing the lm75 device driver on 64 bit systems invokes
undefined behavior, because of an errant cast. Fix this.

This has a side-effect: Whereas before, probing devices matched by
driver name failed with -ENODEV, they are now considered to be
compatible to adt75 instead. As we don't depend on this, this
is deemed acceptable.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/aiodev/lm75.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/aiodev/lm75.c b/drivers/aiodev/lm75.c
index 8186fd2c2b97..4bdccaad5828 100644
--- a/drivers/aiodev/lm75.c
+++ b/drivers/aiodev/lm75.c
@@ -109,9 +109,7 @@ static int lm75_probe(struct device_d *dev)
 	int new, ret;
 	enum lm75_type kind;
 
-	ret = dev_get_drvdata(dev, (const void **)&kind);
-	if (ret)
-		return ret;
+	kind = (enum lm75_type)device_get_match_data(dev);
 
 	data = xzalloc(sizeof(*data));
 
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux