Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79641d86 authored by Nikhilesh Reddy's avatar Nikhilesh Reddy Committed by Gerrit - the friendly Code Review server
Browse files

mtd:oobtest: Check the mtd pointers before dereference



Check the pointers before dereference as the pointers may not always
be initialised correctly.

Change-Id: Id58368bdf577c15151f5e996569ae57e2bd7bf6b
Signed-off-by: default avatarNikhilesh Reddy <reddyn@codeaurora.org>
parent 92317fb0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -406,6 +406,9 @@ static int __init mtd_oobtest_init(void)
	if (err)
		goto out;

	if (!mtd || !(mtd->ecclayout) || !(mtd->ecclayout->oobavail))
		goto out;

	use_offset = 0;
	use_len = mtd->ecclayout->oobavail;
	use_len_max = mtd->ecclayout->oobavail;