mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
memory: omap-gpmc: Fix a couple off by ones
[ Upstream commit4c54228ac8] These comparisons should be >= instead of > to prevent reading one element beyond the end of the gpmc_cs[] array. Fixes:cdd6928c58("ARM: OMAP2+: Add device-tree support for NOR flash") Fixes:f37e4580c4("ARM: OMAP2: Dynamic allocator for GPMC memory space") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Roger Quadros <rogerq@ti.com> Link: https://lore.kernel.org/r/20200825104707.GB278587@mwanda Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f90c8dd3a2
commit
412349b464
@@ -951,7 +951,7 @@ static int gpmc_cs_remap(int cs, u32 base)
|
||||
int ret;
|
||||
u32 old_base, size;
|
||||
|
||||
if (cs > gpmc_cs_num) {
|
||||
if (cs >= gpmc_cs_num) {
|
||||
pr_err("%s: requested chip-select is disabled\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
@@ -986,7 +986,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
|
||||
struct resource *res = &gpmc->mem;
|
||||
int r = -1;
|
||||
|
||||
if (cs > gpmc_cs_num) {
|
||||
if (cs >= gpmc_cs_num) {
|
||||
pr_err("%s: requested chip-select is disabled\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user