From 873f389433f4d43387786999377a450729ad1a4d Mon Sep 17 00:00:00 2001 From: Jonathan Cameron Date: Sun, 3 Sep 2017 18:08:10 +0100 Subject: iio: multiplexer: drop the manual assignment of THIS_MODULE This is now done through some macro magic by the core. Signed-off-by: Jonathan Cameron Acked-by: Peter Rosin --- drivers/iio/multiplexer/iio-mux.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/iio/multiplexer/iio-mux.c') diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c index 37ba007f8dca..92495d309193 100644 --- a/drivers/iio/multiplexer/iio-mux.c +++ b/drivers/iio/multiplexer/iio-mux.c @@ -173,7 +173,6 @@ static const struct iio_info mux_info = { .read_raw = mux_read_raw, .read_avail = mux_read_avail, .write_raw = mux_write_raw, - .driver_module = THIS_MODULE, }; static ssize_t mux_read_ext_info(struct iio_dev *indio_dev, uintptr_t private, -- cgit v1.2.3 From dd92d5ea20ef8a42be7aeda08c669c586c730451 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Thu, 6 Jul 2017 23:53:11 -0500 Subject: iio: multiplexer: add NULL check on devm_kzalloc() and devm_kmemdup() return values Check return values from call to devm_kzalloc() and devm_kmemup() in order to prevent a NULL pointer dereference. This issue was detected using Coccinelle and the following semantic patch: @@ expression x; identifier fld; @@ * x = devm_kzalloc(...); ... when != x == NULL x->fld Fixes: 7ba9df54b091 ("iio: multiplexer: new iio category and iio-mux driver") Signed-off-by: Gustavo A. R. Silva Acked-by: Peter Rosin Signed-off-by: Jonathan Cameron --- drivers/iio/multiplexer/iio-mux.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers/iio/multiplexer/iio-mux.c') diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c index 92495d309193..60621ccd67e4 100644 --- a/drivers/iio/multiplexer/iio-mux.c +++ b/drivers/iio/multiplexer/iio-mux.c @@ -284,6 +284,9 @@ static int mux_configure_channel(struct device *dev, struct mux *mux, child->ext_info_cache = devm_kzalloc(dev, sizeof(*child->ext_info_cache) * num_ext_info, GFP_KERNEL); + if (!child->ext_info_cache) + return -ENOMEM; + for (i = 0; i < num_ext_info; ++i) { child->ext_info_cache[i].size = -1; @@ -308,6 +311,9 @@ static int mux_configure_channel(struct device *dev, struct mux *mux, child->ext_info_cache[i].data = devm_kmemdup(dev, page, ret + 1, GFP_KERNEL); + if (!child->ext_info_cache[i].data) + return -ENOMEM; + child->ext_info_cache[i].data[ret] = 0; child->ext_info_cache[i].size = ret; } -- cgit v1.2.3