From patchwork Thu Jan 22 06:50:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dudley Du X-Patchwork-Id: 5682401 Return-Path: X-Original-To: patchwork-linux-input@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 37BC89F2ED for ; Thu, 22 Jan 2015 06:51:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 59FE9202F0 for ; Thu, 22 Jan 2015 06:51:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EEB76202EB for ; Thu, 22 Jan 2015 06:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751263AbbAVGvC (ORCPT ); Thu, 22 Jan 2015 01:51:02 -0500 Received: from smtp1.cypress.com ([157.95.67.100]:52678 "EHLO smtp1.cypress.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751199AbbAVGvA (ORCPT ); Thu, 22 Jan 2015 01:51:00 -0500 Received: from corpmail1.cypress.com (corpmail1.mis.cypress.com [172.16.5.228]) by smtp1.cypress.com (8.13.8/8.13.8) with ESMTP id t0M6ootc028332; Wed, 21 Jan 2015 22:50:50 -0800 Received: from mailhost.mis.cypress.com (mailhost [172.16.2.5]) by corpmail1.cypress.com (8.14.4/8.14.4) with ESMTP id t0M6oo8K015290; Wed, 21 Jan 2015 22:50:50 -0800 Received: from localhost ([172.23.6.162]) by mailhost.mis.cypress.com (8.12.11/8.12.11) with ESMTP id t0M6om0c025669; Wed, 21 Jan 2015 22:50:49 -0800 (PST) From: Dudley Du To: dmitry.torokhov@gmail.com, jmmahler@gmail.com, rydberg@euromail.se Cc: Dudley Du , bleung@google.com, dan.carpenter@oracle.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] input: cyapa: fix variable dereferenced before check 'gen5_pip->resp_len' issue Date: Thu, 22 Jan 2015 14:50:06 +0800 Message-Id: <1421909406-1240-2-git-send-email-dudl@cypress.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1421909406-1240-1-git-send-email-dudl@cypress.com> References: <1421909406-1240-1-git-send-email-dudl@cypress.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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=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 Fixes the warning issue of the variable dereferenced before check 'gen5_pip->resp_len' report by dan Carpenter. Signed-off-by: Dudley Du --- drivers/input/mouse/cyapa_gen5.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/input/mouse/cyapa_gen5.c b/drivers/input/mouse/cyapa_gen5.c index 69d9059..ed1af74 100644 --- a/drivers/input/mouse/cyapa_gen5.c +++ b/drivers/input/mouse/cyapa_gen5.c @@ -2558,7 +2558,9 @@ static bool cyapa_gen5_irq_cmd_handler(struct cyapa *cyapa) * trackpad device when booting/rebooting * their chrome book. */ - length = *gen5_pip->resp_len; + length = 0; + if (gen5_pip->resp_len) + length = *gen5_pip->resp_len; cyapa_empty_pip_output_data(cyapa, gen5_pip->resp_data, &length,