From patchwork Mon Aug 26 04:55:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2849383 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 386CCBF546 for ; Mon, 26 Aug 2013 04:55:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DE80201FE for ; Mon, 26 Aug 2013 04:55:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7013E2015F for ; Mon, 26 Aug 2013 04:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754784Ab3HZEzn (ORCPT ); Mon, 26 Aug 2013 00:55:43 -0400 Received: from mail-bk0-f47.google.com ([209.85.214.47]:53443 "EHLO mail-bk0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854Ab3HZEzn (ORCPT ); Mon, 26 Aug 2013 00:55:43 -0400 Received: by mail-bk0-f47.google.com with SMTP id mx12so922049bkb.34 for ; Sun, 25 Aug 2013 21:55:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=Fd1q7JGP5ub84gd55OAI+cYCiCLGhUjryewH+Jayzhc=; b=XkIG28q9Et2M6iIwDy3FOHNMcGUIqbacQ824Jxs8VdMEOFdeMTtu89emvVk4s/n4Dj lDIn+bZMTYHN1TtzBXGmTCGPrfRdfOc2o0z0HuqDvg7IGwz5ePHQrdrN81ENNptnBvG/ yGLrgOHioIbq0zCyPCyySiiPOmVnQavmdop39JsJrqgwv84+aAVvdCofAqmw2XM2G9KC y37cBxmFwLzW97lG6ooeJDIrhrVR5y31D0cLqduFyYH6QxAGAdQA8aRrXr2bTLo9SP0F VZifhmaEsRGCiRS288yK7NEdWIk2ILkwi4C87XZm8ZFSJXUKt1QlVLhW51gEpDerXw1b owAQ== MIME-Version: 1.0 X-Received: by 10.205.65.78 with SMTP id xl14mr8616306bkb.1.1377492942328; Sun, 25 Aug 2013 21:55:42 -0700 (PDT) Received: by 10.205.13.74 with HTTP; Sun, 25 Aug 2013 21:55:42 -0700 (PDT) Date: Mon, 26 Aug 2013 12:55:42 +0800 Message-ID: Subject: [PATCH] Input: cyttsp4 - fix potential NULL pointer dereference in cyttsp4_watchdog_timer() From: Wei Yongjun To: javier@dowhile0.org, dmitry.torokhov@gmail.com, fery@cypress.com Cc: yongjun_wei@trendmicro.com.cn, linux-input@vger.kernel.org Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 From: Wei Yongjun The dereference should be moved below the NULL test. Signed-off-by: Wei Yongjun --- drivers/input/touchscreen/cyttsp4_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 963da05..ffa8e35 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1244,11 +1244,11 @@ static void cyttsp4_watchdog_timer(unsigned long handle) { struct cyttsp4 *cd = (struct cyttsp4 *)handle; - dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); - if (!cd) return; + dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); + if (!work_pending(&cd->watchdog_work)) schedule_work(&cd->watchdog_work);