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 079D26FA0 for ; Mon, 16 Jan 2023 16:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 862B4C433F2; Mon, 16 Jan 2023 16:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673887778; bh=pl8/hcTa7gTHcEVObW9zUb3jNJLT1epkIBX2B46Cqys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v/Qen3jQnjTuXcrJXoXZjf5jhb0+gSrfEfZOglmhP4xWnc7awWyFMboG+QsreGv// RSaop2FZzI0c4WhWdRa/+Az+Q0kpA94BL0VblHKUtqPCH00I8yLfYx9YhRxUZdkEeC 5eQdsAYy9GIdKXxbkUzvelOyqJKG4y54d5/9A7TY= 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 4.19 279/521] macintosh/macio-adb: check the return value of ioremap() Date: Mon, 16 Jan 2023 16:49:01 +0100 Message-Id: <20230116154859.632074724@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154847.246743274@linuxfoundation.org> References: <20230116154847.246743274@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