From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Date: Fri, 3 Dec 2010 13:32:21 +0000 (+0200)
Subject: UBI: add a commentary about allocating VID header buffer on stack
X-Git-Tag: firefly_0821_release~7613^2~2150^2~12
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2fff570e7c8f97e411cd852d64b77b92d9ab8da9;p=firefly-linux-kernel-4.4.55.git

UBI: add a commentary about allocating VID header buffer on stack

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---

diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 668d24005106..65915a649861 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -480,6 +480,13 @@ static int nor_erase_prepare(struct ubi_device *ubi, int pnum)
 	size_t written;
 	loff_t addr;
 	uint32_t data = 0;
+	/*
+	 * Note, we cannot generally define VID header buffers on stack,
+	 * because of the way we deal with these buffers (see the header
+	 * comment in this file). But we know this is a NOR-specific piece of
+	 * code, so we can do this. But yes, this is error-prone and we should
+	 * (pre-)allocate VID header buffer instead.
+	 */
 	struct ubi_vid_hdr vid_hdr;
 
 	/*