From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03624145353; Thu, 11 Apr 2024 10:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830626; cv=none; b=d10oIYJW9VA0miIztk6msXhwdMy5jBzzBJiOBv3JikchuRDt49tHbqFe3oSHgwvXdfH5WK9vD40OMV+8njwo5m6pyK0IKJsxNdNsYuWBWgzRq8Th6A/xpUgCBcq9BiIJnXRC9zXi5nHhbT6cJJro8UGph/bUhexDrRt+LOZBXjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830626; c=relaxed/simple; bh=k9iHOEQdkzf84JtRoFdudHlaY5LSlOZL0DY0dM6i9iM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=htsjeRSJrJoOslBCC72jC9LqIHD8nCIO7xrnh93wNWHtslKJ32eW+zTAMZfUj8qI6HKhsP3omkiMDCvy7VNNBYnoP808eiKQUrV3TDkjLQaNcAshG/36BBrPuE0vsKA0Lm1iT7OQgn/L4AvPKgfwxB9N7djvwm8no4ktRHOGEtw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0R5DfNNE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0R5DfNNE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A987C433C7; Thu, 11 Apr 2024 10:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712830625; bh=k9iHOEQdkzf84JtRoFdudHlaY5LSlOZL0DY0dM6i9iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0R5DfNNEgXC2hqkwpJGGV8NcNU8upfE84MhwEsxkTkt0LELD1mybuSdo+RUC0DNfs 3XQGG+bS0m2KR9rFDdqWNFTrrHiLY4mRIqRKKU1F5V/u5W9rZg9X09D2UL6keRF4+U PJcclAHmpOzPzy/tvkTN7XocauB2caRClupErla0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhang Yi , Zhihao Cheng , Richard Weinberger , Sasha Levin Subject: [PATCH 5.4 026/215] ubi: correct the calculation of fastmap size Date: Thu, 11 Apr 2024 11:53:55 +0200 Message-ID: <20240411095425.669623210@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095424.875421572@linuxfoundation.org> References: <20240411095424.875421572@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhang Yi [ Upstream commit 7f174ae4f39e8475adcc09d26c5a43394689ad6c ] Now that the calculation of fastmap size in ubi_calc_fm_size() is incorrect since it miss each user volume's ubi_fm_eba structure and the Internal UBI volume info. Let's correct the calculation. Cc: stable@vger.kernel.org Signed-off-by: Zhang Yi Reviewed-by: Zhihao Cheng Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin --- drivers/mtd/ubi/fastmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 6e95c4b1473e6..8081fc760d34f 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -86,9 +86,10 @@ size_t ubi_calc_fm_size(struct ubi_device *ubi) sizeof(struct ubi_fm_scan_pool) + sizeof(struct ubi_fm_scan_pool) + (ubi->peb_count * sizeof(struct ubi_fm_ec)) + - (sizeof(struct ubi_fm_eba) + - (ubi->peb_count * sizeof(__be32))) + - sizeof(struct ubi_fm_volhdr) * UBI_MAX_VOLUMES; + ((sizeof(struct ubi_fm_eba) + + sizeof(struct ubi_fm_volhdr)) * + (UBI_MAX_VOLUMES + UBI_INT_VOL_COUNT)) + + (ubi->peb_count * sizeof(__be32)); return roundup(size, ubi->leb_size); } -- 2.43.0