lib/logic_iomem: Fix operation on 32-bit
authorJohannes Berg <johannes.berg@intel.com>
Wed, 15 Sep 2021 18:30:22 +0000 (20:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:03:44 +0000 (11:03 +0100)
commit4e71908ba7cb581342205a9d3b4a8b56109e3ae8
treea866034d12d4a27b01adcf95ebc254add372c984
parent6c72a5bc4df4565164569d4833efc6f19c44dcbc
lib/logic_iomem: Fix operation on 32-bit

[ Upstream commit 4e8a5edac5010820e7c5303fc96f5a262e096bb6 ]

On 32-bit, the first entry might be at 0/NULL, but that's
strange and leads to issues, e.g. where we check "if (ret)".
Use a IOREMAP_BIAS/IOREMAP_MASK of 0x80000000UL to avoid
this. This then requires reducing the number of areas (via
MAX_AREAS), but we still have 128 areas, which is enough.

Fixes: ca2e334232b6 ("lib: add iomem emulation (logic_iomem)")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/logic_iomem.c