From: Xie Shaowen Date: Tue, 2 Aug 2022 07:41:48 +0000 (+0800) Subject: macintosh/macio-adb: check the return value of ioremap() X-Git-Tag: v6.2-rc1~52^2~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dbaa3105736d4d73063ea0a3b01cd7fafce924e6;p=thirdparty%2Fkernel%2Flinux.git macintosh/macio-adb: check the return value of ioremap() 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 --- diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c index 3721402582b4f..55a9f8c3a150e 100644 --- a/drivers/macintosh/macio-adb.c +++ b/drivers/macintosh/macio-adb.c @@ -108,6 +108,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);