Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2686398pxy; Mon, 3 May 2021 05:58:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTsERHe6fXAIpcjSwqfK4G1zeCO6Kq7zQgAK0unGZZi9enBydG0uKhFnGhhxgMYUGMz0DE X-Received: by 2002:a05:6a00:15ce:b029:28e:7a15:107f with SMTP id o14-20020a056a0015ceb029028e7a15107fmr7396859pfu.81.1620046692917; Mon, 03 May 2021 05:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620046692; cv=none; d=google.com; s=arc-20160816; b=mY2WjEZpCsiNPWCqpe9xU3e6Yv5fgmynKUwkY++2NHBpsYf1+wPwsVvtqdL0wXhlT2 R4CXP/zM496XMsDxNog/QapzhhxHcMKl1QOVcqj89GLgDHncrItM17LKLbrSY+bC3EPw vUZaQQx6l3f+ShzJwJN01dpGzkJDjiY9IAEv4HwrnV0MXH7/NtDZvg7Lcs/YjRbjXGLi shVq9imbdBe0YurVkJcIqQjYjh4+qe3hnvHak6YHMLf94HfLkV43YANA7YG+pUqDBnC3 ESXNn1l1zw4hqaIGUhZ+ZF2SZbqwc2/nWzgP4B933Ubsip6JCQdvRKFiGypK+rTBoM4C YRGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gGmfkfoK4zRYGJ+F9n+Q+o+yi5ywypaa+9103DG1F9A=; b=GbBaDnzwixl8W5QEmJK48rMxbGWNA8UxMq6FaMbw97tZlgSPAb2yiLwXfpKNW8Yifa DWGrQznslkWWVOPOQL4Yerb3gvwmt4ZisRsbHkqWD+Zq8DJkjuBAVNumb5vNlI3T3JVY EiV1dxiZ1CEHgsiyoRivWgErLXazjP/ohTN9J203jw4CUYrOdthB2blWmwsJdgUlpUIc gOva1K5/PZjjcRmGTAyNz5VyHuyAIG3fsXNp5/P+zxNtrgiD3377wAzBaWkgnq622C2o 8XK97LS+5NLubUc8UsxYVPCi93DndJ/w7sqQkMInLuwqmdpS4PLGqE/+ZxM3kxw5VQLO lKkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="GezIq1N/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si14483536pgk.50.2021.05.03.05.57.59; Mon, 03 May 2021 05:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="GezIq1N/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233837AbhECMAy (ORCPT + 99 others); Mon, 3 May 2021 08:00:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:34834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233449AbhECMAe (ORCPT ); Mon, 3 May 2021 08:00:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 101A261221; Mon, 3 May 2021 11:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620043181; bh=PasxI9fq3tjDUoKO99fOGOPWeNEd0Xo8z+KLCALVXuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GezIq1N/PCCqsTe3/9TCLWL8CVBNO5San8Mn8jfX6GoIlZlkPqXWvj4CG994FyJGi 7grcOABzrcJ/igqRkcOyZdZvT//ZfpmjuMwoCiCBz0nVsPAA1my12RJ53hkR6YCKy8 QCc0H/FYQSgLXVuIY19zD1fYPDhMDtibQjKkIUO4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Tom Seewald , Greg Kroah-Hartman Subject: [PATCH 29/69] char: hpet: add checks after calling ioremap Date: Mon, 3 May 2021 13:56:56 +0200 Message-Id: <20210503115736.2104747-30-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210503115736.2104747-1-gregkh@linuxfoundation.org> References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tom Seewald The function hpet_resources() calls ioremap() two times, but in both cases it does not check if ioremap() returned a null pointer. Fix this by adding null pointer checks and returning an appropriate error. Signed-off-by: Tom Seewald Signed-off-by: Greg Kroah-Hartman --- drivers/char/hpet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 6f13def6c172..8b55085650ad 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -969,6 +969,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) if (ACPI_SUCCESS(status)) { hdp->hd_phys_address = addr.address.minimum; hdp->hd_address = ioremap(addr.address.minimum, addr.address.address_length); + if (!hdp->hd_address) + return AE_ERROR; if (hpet_is_known(hdp)) { iounmap(hdp->hd_address); @@ -982,6 +984,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data) hdp->hd_phys_address = fixmem32->address; hdp->hd_address = ioremap(fixmem32->address, HPET_RANGE_SIZE); + if (!hdp->hd_address) + return AE_ERROR; if (hpet_is_known(hdp)) { iounmap(hdp->hd_address); -- 2.31.1