From mboxrd@z Thu Jan 1 00:00:00 1970 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 4D350C678D9 for ; Mon, 16 Jan 2023 16:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbjAPQgt (ORCPT ); Mon, 16 Jan 2023 11:36:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233358AbjAPQgZ (ORCPT ); Mon, 16 Jan 2023 11:36:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A58B31E3F for ; Mon, 16 Jan 2023 08:25:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3535AB81063 for ; Mon, 16 Jan 2023 16:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A6ADC433F1; Mon, 16 Jan 2023 16:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673886308; bh=pl8/hcTa7gTHcEVObW9zUb3jNJLT1epkIBX2B46Cqys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=seNatXt40TmgvJZrkFS4PH4nWDOwCIDE1NDcxlC5tJHemFmxj+XmcBdK/CYIBos7t JvriYJOypf8lI2TMba4SeFwPFSlrN9Gzi9lePEspNar2YqqKvhtYs9Qfv14oLkkD15 FEEYRhe9NJDFnhxEyeqXczZTmCs8tb8IhTYqfX1o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hacash Robot , Xie Shaowen , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 352/658] macintosh/macio-adb: check the return value of ioremap() Date: Mon, 16 Jan 2023 16:47:20 +0100 Message-Id: <20230116154925.681724251@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154909.645460653@linuxfoundation.org> References: <20230116154909.645460653@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Xie Shaowen [ Upstream commit dbaa3105736d4d73063ea0a3b01cd7fafce924e6 ] The function ioremap() in macio_init() can fail, so its return value should be checked. Fixes: 36874579dbf4c ("[PATCH] powerpc: macio-adb build fix") Reported-by: Hacash Robot Signed-off-by: Xie Shaowen Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220802074148.3213659-1-studentxswpy@163.com Signed-off-by: Sasha Levin --- drivers/macintosh/macio-adb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c index eb3adfb7f88d..172a8b18c579 100644 --- a/drivers/macintosh/macio-adb.c +++ b/drivers/macintosh/macio-adb.c @@ -106,6 +106,10 @@ int macio_init(void) return -ENXIO; } adb = ioremap(r.start, sizeof(struct adb_regs)); + if (!adb) { + of_node_put(adbs); + return -ENOMEM; + } out_8(&adb->ctrl.r, 0); out_8(&adb->intr.r, 0); -- 2.35.1