Patch "memory: omap-gpmc: Fix a couple off by ones" has been added to the 5.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    memory: omap-gpmc: Fix a couple off by ones

to the 5.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     memory-omap-gpmc-fix-a-couple-off-by-ones.patch
and it can be found in the queue-5.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 83d166c783e88384b7e880e6ba8f6c14fa440440
Author: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Date:   Tue Aug 25 13:47:07 2020 +0300

    memory: omap-gpmc: Fix a couple off by ones
    
    [ Upstream commit 4c54228ac8fd55044195825873c50a524131fa53 ]
    
    These comparisons should be >= instead of > to prevent reading one
    element beyond the end of the gpmc_cs[] array.
    
    Fixes: cdd6928c589a ("ARM: OMAP2+: Add device-tree support for NOR flash")
    Fixes: f37e4580c409 ("ARM: OMAP2: Dynamic allocator for GPMC memory space")
    Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Acked-by: Roger Quadros <rogerq@xxxxxx>
    Link: https://lore.kernel.org/r/20200825104707.GB278587@mwanda
    Signed-off-by: Krzysztof Kozlowski <krzk@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index ca0097664b125..1e6d6e9434c8b 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -943,7 +943,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;
 	}
@@ -978,7 +978,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;
 	}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux