mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
char: hpet: add checks after calling ioremap
[ Upstream commit b11701c933 ]
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 <tseewald@gmail.com>
Link: https://lore.kernel.org/r/20210503115736.2104747-30-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0f4e71f3d3
commit
c8972b1404
@@ -969,6 +969,8 @@ static acpi_status hpet_resources(struct acpi_resource *res, void *data)
|
|||||||
if (ACPI_SUCCESS(status)) {
|
if (ACPI_SUCCESS(status)) {
|
||||||
hdp->hd_phys_address = addr.address.minimum;
|
hdp->hd_phys_address = addr.address.minimum;
|
||||||
hdp->hd_address = ioremap(addr.address.minimum, addr.address.address_length);
|
hdp->hd_address = ioremap(addr.address.minimum, addr.address.address_length);
|
||||||
|
if (!hdp->hd_address)
|
||||||
|
return AE_ERROR;
|
||||||
|
|
||||||
if (hpet_is_known(hdp)) {
|
if (hpet_is_known(hdp)) {
|
||||||
iounmap(hdp->hd_address);
|
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_phys_address = fixmem32->address;
|
||||||
hdp->hd_address = ioremap(fixmem32->address,
|
hdp->hd_address = ioremap(fixmem32->address,
|
||||||
HPET_RANGE_SIZE);
|
HPET_RANGE_SIZE);
|
||||||
|
if (!hdp->hd_address)
|
||||||
|
return AE_ERROR;
|
||||||
|
|
||||||
if (hpet_is_known(hdp)) {
|
if (hpet_is_known(hdp)) {
|
||||||
iounmap(hdp->hd_address);
|
iounmap(hdp->hd_address);
|
||||||
|
|||||||
Reference in New Issue
Block a user