From patchwork Tue Aug 2 07:20:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: studentxswpy@163.com X-Patchwork-Id: 12934283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A449C00140 for ; Tue, 2 Aug 2022 07:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233933AbiHBHVd (ORCPT ); Tue, 2 Aug 2022 03:21:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233010AbiHBHVd (ORCPT ); Tue, 2 Aug 2022 03:21:33 -0400 Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3575314D22; Tue, 2 Aug 2022 00:21:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=SQ1A9 rHYoE2LE5roYoK9D1dhwBdnDWhdPz3jmUXmsvI=; b=X3OmEQrkSgOjndmfEkswJ tnU90CxjS046ecbfNclCftwhVu2coa+WDTGW7fCql/jS7OeTuRnpJfMvKMCo0KZ4 hj1NZD0wFzW4FdzS2U5Z9ZMQgAeXPRS7P6opaOOJ3fCimd/+LTE3Zl5GLGo4Caa6 m+ZxHl+HUZT21JKXPClYvE= Received: from localhost.localdomain (unknown [123.58.221.99]) by smtp2 (Coremail) with SMTP id GtxpCgA3re9E0OhinfOTSw--.5314S2; Tue, 02 Aug 2022 15:20:38 +0800 (CST) From: studentxswpy@163.com To: James.Bottomley@HansenPartnership.com, deller@gmx.de, dmitry.torokhov@gmail.com, linux-parisc@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xie Shaowen , Hacash Robot Subject: [PATCH] Input: check the return value of ioremap() in gscps2_probe() Date: Tue, 2 Aug 2022 15:20:33 +0800 Message-Id: <20220802072033.3211980-1-studentxswpy@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: GtxpCgA3re9E0OhinfOTSw--.5314S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Xw4DZFWUtw1fXr45ZFy8uFg_yoWfurbE9a sYvF1Sqr4jkr4rtr1DWrnxZ3Z8tws7Zr95ZFnYyasakFy8Ww1DAa1UWF1DZw15W3Z7XrZ8 CrZYgFZavw1fWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8JxhPUUUUU== X-Originating-IP: [123.58.221.99] X-CM-SenderInfo: xvwxvv5qw024ls16il2tof0z/xtbB0wpRJFXlwVGjCQAAsm Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org From: Xie Shaowen The function ioremap() in gscps2_probe() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Reported-by: Hacash Robot Signed-off-by: Xie Shaowen --- drivers/input/serio/gscps2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index a9065c6ab550..da2c67cb8642 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -350,6 +350,10 @@ static int __init gscps2_probe(struct parisc_device *dev) ps2port->port = serio; ps2port->padev = dev; ps2port->addr = ioremap(hpa, GSC_STATUS + 4); + if (!ps2port->addr) { + ret = -ENOMEM; + goto fail_nomem; + } spin_lock_init(&ps2port->lock); gscps2_reset(ps2port);