From patchwork Wed Dec 26 01:51:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10742771 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F345114DE for ; Wed, 26 Dec 2018 01:52:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1D9928926 for ; Wed, 26 Dec 2018 01:52:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5045289BA; Wed, 26 Dec 2018 01:52:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2195289B6 for ; Wed, 26 Dec 2018 01:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725989AbeLZBwB (ORCPT ); Tue, 25 Dec 2018 20:52:01 -0500 Received: from mta-p5.oit.umn.edu ([134.84.196.205]:49804 "EHLO mta-p5.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725961AbeLZBwB (ORCPT ); Tue, 25 Dec 2018 20:52:01 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p5.oit.umn.edu (Postfix) with ESMTP id E02ADA7A for ; Wed, 26 Dec 2018 01:51:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p5.oit.umn.edu ([127.0.0.1]) by localhost (mta-p5.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c1dLNTQCTxHf for ; Tue, 25 Dec 2018 19:51:59 -0600 (CST) Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p5.oit.umn.edu (Postfix) with ESMTPS id AA3F2A0A for ; Tue, 25 Dec 2018 19:51:59 -0600 (CST) Received: by mail-io1-f70.google.com with SMTP id b8so2532124ion.5 for ; Tue, 25 Dec 2018 17:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=icHXuY3EHnw/hQv6RlDa7X35TA+Ci/575h0Cz2uSOgQ=; b=chPktIXqBnEYINHmDKZOqXtBYrxdQrzbmd+Ud+8F1jlrZ8jJGN19M+4vL8lBFZ7A3F AmEoAby2Fpi/7cOfpoEUBjRW1KnRxDn99nwyvX62v0KJhrqqDPhmkTm9JLPcpFvW70b1 PlBMXpVuG5GGku+iQx70vNu1YKnLYMgxDTSfMVcnxs3ngme5EW0usVnCDkUDuF4UFvAD Ea1lmpeDAqVJ87GpWgEsMYZWaQoEeygKEajFy+4tjCUfpVe9exMXL/FO3scOTCkBDK5O LP/LIaEdAbBX2Kb/gar4TeiLmpxv/tk5rtz7hivw7Fnb/RkbDmaWv4LUdISrfQqp6NVt LvQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=icHXuY3EHnw/hQv6RlDa7X35TA+Ci/575h0Cz2uSOgQ=; b=rVnOHS0aejHDlYEdpZXBu0bjjMKFSxIfGW0B0cfe8yNcG+ZLZD1pGE3rOcXmHNRDWG Z4nHDjXiDXtuy7KwNVfdpSgiJctK7JYp6oxUA0oXix0wxefJtH3KWKWPLxo/Nn+6V/N2 vzPw2r8sf6lOyspELXpXGGxrhZ52R6Yf+jgucNsUa+p5BOI67mzFftFkNBcrrZzSoy0W Itc05R/Tco6haWymwkkLYL8LYJuk21swkKTwAzH4vPeYMBL6T5kdViTEaZkSnqnqeUlG VUg7wx2XV86Ldd9kibjJrEkTNhHAw6PbduPR21mOhFKX3Hgd8EuFtWGzh9mqjM5p3mXa uOuQ== X-Gm-Message-State: AA+aEWb90EdPpGRt1YQyczvhmIW5tfhG6s7QUImiygyRIR9JGImCqFgS g1417taFaYnLh9qzGkXwblGj0g2+udSyuF+qGmicG5xVUuxTUnGWLVPrVSS7QiKI2IFXMCI6lYR 2G2Zc+jbW0Bgtxr3MlIuUkHHYIB0= X-Received: by 2002:a24:bc1:: with SMTP id 184mr12362633itd.50.1545789119304; Tue, 25 Dec 2018 17:51:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UueGYJ3nJsMWpDbQqZsaNiFhY8M99vfh4loixeJjqqIKoEqPMjtIpCR0AFSI74XtcsaYZ9jQ== X-Received: by 2002:a24:bc1:: with SMTP id 184mr12362627itd.50.1545789119083; Tue, 25 Dec 2018 17:51:59 -0800 (PST) Received: from localhost.localdomain (host-173-230-104-22.mnmigsc.mn.minneapolis.us.clients.pavlovmedia.net. [173.230.104.22]) by smtp.gmail.com with ESMTPSA id 195sm11832320itm.2.2018.12.25.17.51.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Dec 2018 17:51:58 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Dmitry Torokhov , Kees Cook , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] keyboard: (samsung) fix a missing check of return value Date: Tue, 25 Dec 2018 19:51:29 -0600 Message-Id: <20181226015131.71198-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.2 (Apple Git-113) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP of_device_is_compatible() returns false if the device is incompatible. The fix adds a check for its return value; Signed-off-by: Kangjie Lu --- drivers/input/keyboard/samsung-keypad.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 1fe1aa2adf85..5ba940f3f76e 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -387,9 +387,13 @@ static int samsung_keypad_probe(struct platform_device *pdev) keypad->stopped = true; init_waitqueue_head(&keypad->wait); - if (pdev->dev.of_node) - keypad->type = of_device_is_compatible(pdev->dev.of_node, - "samsung,s5pv210-keypad"); + if (pdev->dev.of_node) { + error = of_device_is_compatible(pdev->dev.of_node, + "samsung,s5pv210-keypad"); + if (!error) + return -EINVAL; + keypad->type = error; + } else keypad->type = platform_get_device_id(pdev)->driver_data;