summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorPeter Mamonov <pmamonov@gmail.com>2018-05-22 18:33:34 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2018-05-24 12:45:10 +0200
commitdddeabe237a6f5fb2e189d721733b1f54575edea (patch)
treece9e2e25a373ffc2c199826a4a2c14a881947212 /drivers/i2c
parentf1ef09542d2dfaccb7d10e94b9d165eb40d1d19b (diff)
downloadbarebox-dddeabe237a6f5fb2e189d721733b1f54575edea.tar.gz
barebox-dddeabe237a6f5fb2e189d721733b1f54575edea.tar.xz
i2c-mux-pca954x: fix out-of-bounds write for 64 bit systems
get_drv_data(..., &data->type) overwrites memory beyond data->type member due to mismatch of sizeof(enum pca_type) and sizeof(void *) on 64 bit systems. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/muxes/i2c-mux-pca954x.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 0d5515b716..395254cdca 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -180,6 +180,7 @@ static int pca954x_probe(struct device_d *dev)
struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent);
int num, force;
struct pca954x *data;
+ uintptr_t tmp;
int ret = -ENODEV;
int gpio;
@@ -203,7 +204,8 @@ static int pca954x_probe(struct device_d *dev)
goto exit_free;
}
- ret = dev_get_drvdata(dev, (const void **)&data->type);
+ ret = dev_get_drvdata(dev, (const void **)&tmp);
+ data->type = tmp;
if (ret)
goto exit_free;