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 D0472749F for ; Thu, 12 Jan 2023 14:21:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37AFAC433D2; Thu, 12 Jan 2023 14:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673533295; bh=iaHhf4jyQ6UpD9eH7qonXdE6Xa+4+4bfnh3agU2pf5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXUbR0ZpiCjhbqTM7WICADZGoOCA6p47mCLVF/fIp7TcPxfins2JRr3VMvKrhwmaK yGG9mJ0V/FrWdLp7o6pIt3AGenqkiBLou82XQUeoGAeis8y4n4jy72no1TqWv444Zr sT+a5U2Fng1MoWeWx3WllXFNvaM/tZPQIfz+qlno= 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.10 431/783] macintosh/macio-adb: check the return value of ioremap() Date: Thu, 12 Jan 2023 14:52:27 +0100 Message-Id: <20230112135544.299641415@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230112135524.143670746@linuxfoundation.org> References: <20230112135524.143670746@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 d4759db002c6..defe65f51fa2 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