Blame SOURCES/0072-fs-ntfs3-Initialize-pointer-before-use-place-in-fill.patch

Kmods SIG 8b815c
From 0e59a87ee619915c2eb189eb232a972c276681fb Mon Sep 17 00:00:00 2001
Kmods SIG 8b815c
From: Kari Argillander <kari.argillander@gmail.com>
Kmods SIG 8b815c
Date: Thu, 9 Sep 2021 21:09:41 +0300
Kmods SIG 8b815c
Subject: [Backport 0e59a87ee619] src: Initialize pointer before use place
Kmods SIG 8b815c
 in fill_super
Kmods SIG 8b815c
Kmods SIG 8b815c
Initializing should be as close as possible when we use it so that
Kmods SIG 8b815c
we do not need to scroll up to see what is happening.
Kmods SIG 8b815c
Kmods SIG 8b815c
Also bdev_get_queue() can never return NULL so we do not need to check
Kmods SIG 8b815c
for !rq.
Kmods SIG 8b815c
Kmods SIG 8b815c
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Kmods SIG 8b815c
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Kmods SIG 8b815c
---
Kmods SIG 8b815c
 src/super.c | 7 +++----
Kmods SIG 8b815c
 1 file changed, 3 insertions(+), 4 deletions(-)
Kmods SIG 8b815c
Kmods SIG 8b815c
diff --git a/src/super.c b/src/super.c
Kmods SIG 8b815c
index 8ce0d4f439a1e26b9f12dbdab0fbb946da859adb..3d034eac2bd197408e7e64a279799d68ad1a8129 100644
Kmods SIG 8b815c
--- a/src/super.c
Kmods SIG 8b815c
+++ b/src/super.c
Kmods SIG 8b815c
@@ -875,7 +875,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
Kmods SIG 8b815c
 	int err;
Kmods SIG 8b815c
 	struct ntfs_sb_info *sbi = sb->s_fs_info;
Kmods SIG 8b815c
 	struct block_device *bdev = sb->s_bdev;
Kmods SIG 8b815c
-	struct request_queue *rq = bdev_get_queue(bdev);
Kmods SIG 8b815c
+	struct request_queue *rq;
Kmods SIG 8b815c
 	struct inode *inode;
Kmods SIG 8b815c
 	struct ntfs_inode *ni;
Kmods SIG 8b815c
 	size_t i, tt;
Kmods SIG 8b815c
@@ -904,9 +904,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
Kmods SIG 8b815c
 		return -EINVAL;
Kmods SIG 8b815c
 	}
Kmods SIG 8b815c
 
Kmods SIG 8b815c
-	if (!rq || !blk_queue_discard(rq) || !rq->limits.discard_granularity) {
Kmods SIG 8b815c
-		;
Kmods SIG 8b815c
-	} else {
Kmods SIG 8b815c
+	rq = bdev_get_queue(bdev);
Kmods SIG 8b815c
+	if (blk_queue_discard(rq) && rq->limits.discard_granularity) {
Kmods SIG 8b815c
 		sbi->discard_granularity = rq->limits.discard_granularity;
Kmods SIG 8b815c
 		sbi->discard_granularity_mask_inv =
Kmods SIG 8b815c
 			~(u64)(sbi->discard_granularity - 1);
Kmods SIG 8b815c
-- 
Kmods SIG 8b815c
2.31.1
Kmods SIG 8b815c