From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11B0046B5 for ; Mon, 16 Jan 2023 16:25:09 +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 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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