From patchwork Fri Feb 6 13:07:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 5791691 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 244189F399 for ; Fri, 6 Feb 2015 13:07:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6E3E520173 for ; Fri, 6 Feb 2015 13:07:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 984E52021F for ; Fri, 6 Feb 2015 13:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755231AbbBFNHZ (ORCPT ); Fri, 6 Feb 2015 08:07:25 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:26126 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755252AbbBFNHZ (ORCPT ); Fri, 6 Feb 2015 08:07:25 -0500 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NJC00ECMPSB9F40@mailout1.samsung.com>; Fri, 06 Feb 2015 22:07:23 +0900 (KST) X-AuditID: cbfee61b-f79d76d0000024d6-a2-54d4bc8b8f6f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 08.27.09430.B8CB4D45; Fri, 06 Feb 2015 22:07:23 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NJC00A6MPS292A0@mmp1.samsung.com>; Fri, 06 Feb 2015 22:07:23 +0900 (KST) From: Lukasz Majewski To: Eduardo Valentin Cc: Zhang Rui , Linux PM list , "linux-samsung-soc@vger.kernel.org" , Bartlomiej Zolnierkiewicz , Lukasz Majewski , Abhilash Kesavan , Abhilash Kesavan , Chanwoo Choi , Lukasz Majewski Subject: [PATCH] thermal: exynos: fix: Check if data->tmu_read callback is present before read Date: Fri, 06 Feb 2015 14:07:10 +0100 Message-id: <1423228030-18708-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjluLIzCtJLcpLzFFi42I5/e+xgG73nishBmfWc1o8XrOYyWLjjPWs Fte/PGe1mH/lGqvFmr9KFm8ecVu8ebiZ0eJz7xFGixnn9zFZPHnYx+bA5bFz1l12j8V7XjJ5 rJv2ltmjb8sqRo/Pm+QCWKO4bFJSczLLUov07RK4Mr7PvcBWsIit4sziGUwNjAtZuxg5OSQE TCQu/2tjgrDFJC7cW88GYgsJLGKUuH/cH8LuYpI4cFYLxGYT0JP4fPcpWL2IgJbEiUvbgWwu DmaBlcwSZ36tYwRJCAskSByecQLI5uBgEVCVWPucHcTkFXCT2NUjB7FKUaL72QS2CYzcCxgZ VjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIEh84z6R2MqxosDjEKcDAq8fAm8F4JEWJNLCuu zD3EKMHBrCTC27MUKMSbklhZlVqUH19UmpNafIhRmoNFSZxXyb4tREggPbEkNTs1tSC1CCbL xMEp1cCoEd2f4/yKL57DYFe8zqtHr/f/2yfqkJN2l2N5En/q2fxtM5dreLZtyFpglCYgsLiC o3qBoHf+M/Pq2OgbbpvdH28X3frmWGP9JMWNrjNENv0zSplyen7gTAFlbQ3uR7v3MOU+uvHx YMb8UgPjyjXRPIeP2Dr+f+b1oWlb8LkVwvUHLTauufBeiaU4I9FQi7moOBEAZiESrBkCAAA= Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Abhilash Kesavan --- 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);