From dfe4a47b7e48ef7e35238d8a0841a48ab842c1a0 Mon Sep 17 00:00:00 2001 From: Pradeep P V K Date: Wed, 9 Mar 2022 10:56:08 +0530 Subject: [PATCH] ubi: Use UBI_MAX_VOLUME_NAME for printing ubi volume names Use UBI_MAX_VOLUME_NAME length for printing ubi volume names to avoid truncation of ubi volume name fields. Change-Id: I0ab4577dcc1e4bb93d2bcef1b8e52da98f13ff15 Signed-off-by: Pradeep P V K --- drivers/mtd/ubi/vmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c index 327f369d9fd0..e1fa76b88469 100644 --- a/drivers/mtd/ubi/vmt.c +++ b/drivers/mtd/ubi/vmt.c @@ -86,7 +86,7 @@ static ssize_t vol_attribute_show(struct device *dev, } ret = scnprintf(buf, size, "%s\n", tp); } else if (attr == &attr_vol_name) - ret = scnprintf(buf, vol->name_len + 1, "%s\n", + ret = scnprintf(buf, UBI_MAX_VOLUME_NAME + 1, "%s\n", vol->name); else if (attr == &attr_vol_corrupted) ret = scnprintf(buf, sizeof(int), "%d\n",