[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <001901cf5221$52161110$f6423330$@codeaurora.org>
Date: Mon, 7 Apr 2014 08:22:05 +0300
From: "Dolev Raviv" <draviv@...eaurora.org>
To: "'Tanya Brokhman'" <tlinder@...eaurora.org>, <dedekind1@...il.com>
Cc: <linux-mtd@...ts.infradead.org>,
"'open list'" <linux-kernel@...r.kernel.org>
Subject: RE: [RFC/PATCH] mtd: ubi: Test return value of __wl_get_peb
Reviewed-by: Dolev Raviv <draviv@...eaurora.org>
Thanks,
Dolev
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
-----Original Message-----
From: linux-mtd [mailto:linux-mtd-bounces@...ts.infradead.org] On Behalf Of
Tanya Brokhman
Sent: Tuesday, April 01, 2014 11:01 AM
To: dedekind1@...il.com
Cc: linux-mtd@...ts.infradead.org; open list; Tanya Brokhman
Subject: [RFC/PATCH] mtd: ubi: Test return value of __wl_get_peb
In case of an error (if there are not free PEB's for example), __wl_get_peb
will return a negative value. In order to prevent access violation we need
to test the returned value prior to using it later on.
Signed-off-by: Tatyana Brokhman <tlinder@...eaurora.org>
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index
02317c1..457ead3 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -684,6 +684,9 @@ int ubi_wl_get_peb(struct ubi_device *ubi)
peb = __wl_get_peb(ubi);
spin_unlock(&ubi->wl_lock);
+ if (peb < 0)
+ return peb;
+
err = ubi_self_check_all_ff(ubi, peb, ubi->vid_hdr_aloffset,
ubi->peb_size - ubi->vid_hdr_aloffset);
if (err) {
--
1.7.6
--
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists