From: Tanya Brokhman <tlin...@codeaurora.org> 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 <tlin...@codeaurora.org> Reviewed-by: Dolev Raviv <dra...@codeaurora.org> Acked-by: Richard Weinberger <rich...@nod.at> Signed-off-by: Artem Bityutskiy <artem.bityuts...@linux.intel.com> --- drivers/mtd/ubi/wl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index c083cac..4ecbe18 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -646,6 +646,9 @@ int ubi_wl_get_peb(struct ubi_device *ubi) peb = __wl_get_peb(ubi); + 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) { -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox