From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Subject: Re: [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read Date: Mon, 16 Feb 2015 10:53:59 +0100 Message-ID: <20150216105359.1b39fac8@amdc2363> References: <1423228030-18708-1-git-send-email-l.majewski@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-reply-to: <1423228030-18708-1-git-send-email-l.majewski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org To: Eduardo Valentin Cc: Lukasz Majewski , Zhang Rui , Linux PM list , "linux-samsung-soc@vger.kernel.org" , Bartlomiej Zolnierkiewicz , Lukasz Majewski , Abhilash Kesavan , Abhilash Kesavan , Chanwoo Choi List-Id: linux-pm@vger.kernel.org Hi Eduardo, > The exynos_tmu_data() function should on entrance test not only for > valid data pointer, but also for data->tmu_read one. > It is important, since afterwards it is dereferenced to get > temperature code. > > Signed-off-by: Lukasz Majewski > --- > drivers/thermal/samsung/exynos_tmu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/thermal/samsung/exynos_tmu.c > b/drivers/thermal/samsung/exynos_tmu.c index 3a19353..a86e0495e 100644 > --- a/drivers/thermal/samsung/exynos_tmu.c > +++ b/drivers/thermal/samsung/exynos_tmu.c > @@ -717,7 +717,7 @@ static int exynos_get_temp(void *p, long *temp) > { > struct exynos_tmu_data *data = p; > > - if (!data) > + if (!data || !data->tmu_read) > return -EINVAL; > > mutex_lock(&data->lock); This fix shall be added to v3.20. -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group