Skip to contentSkip to conversation

OMAP: cs should be positive in gpmc_cs_free()

PATCH Tony Lindgren 1 participant 1 message Nov 18, 2009 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 4 lines · * [email protected] <[email protected]> [091117 14:39]:

From: Roel Kluin <[email protected]>

The index `cs' is signed, test whether it is negative before we release gpmc_cs_mem[cs].

I've added this too to omap-fixes and will send to Linus.

Regards,

Tony

Quoted 22 lines

---

 arch/arm/mach-omap2/gpmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN arch/arm/mach-omap2/gpmc.c~omap-cs-should-be-positive-in-gpmc_cs_free arch/arm/mach-omap2/gpmc.c

arch/arm/mach-omap2/gpmc.c renamed from arch/arm/mach-omap2/gpmc.c~omap-cs-should-be-positive-in-gpmc_cs_free +1 -1
@@ -405,7 +405,7 @@ EXPORT_SYMBOL(gpmc_cs_request);
 void gpmc_cs_free(int cs)
 {
 	spin_lock(&gpmc_mem_lock);
-	if (cs >= GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
+	if (cs >= GPMC_CS_NUM || cs < 0 || !gpmc_cs_reserved(cs)) {
 		printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
 		BUG();
 		spin_unlock(&gpmc_mem_lock);

_