lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  6 Jan 2017 21:53:55 +0100
From:   Fabian Frederick <fabf@...net.be>
To:     Jan Kara <jack@...e.com>
Cc:     fabf@...net.be, linux-kernel@...r.kernel.org,
        linux-fsdevel@...r.kernel.org
Subject: [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents()

recalculate offset if needed.

Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 fs/udf/inode.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index f563e97..66514ad 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -998,10 +998,10 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 				length : UDF_DEFAULT_PREALLOC_BLOCKS) -
 				currlength);
 		if (numalloc) 	{
+			loff_t pos = numalloc << inode->i_sb->s_blocksize_bits;
+
 			if (start == (c + 1))
-				laarr[start].extLength +=
-					(numalloc <<
-					 inode->i_sb->s_blocksize_bits);
+				laarr[start].extLength += pos;
 			else {
 				memmove(&laarr[c + 2], &laarr[c + 1],
 					sizeof(struct long_ad) * (*endnum - (c + 1)));
@@ -1011,9 +1011,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 					laarr[c].extLocation.
 							partitionReferenceNum;
 				laarr[c + 1].extLength =
-					EXT_NOT_RECORDED_ALLOCATED |
-					(numalloc <<
-					 inode->i_sb->s_blocksize_bits);
+					EXT_NOT_RECORDED_ALLOCATED | pos;
 				start = c + 1;
 			}
 
@@ -1024,12 +1022,12 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 					    inode->i_sb->s_blocksize_bits;
 
 				if (elen > numalloc) {
-					laarr[i].extLength -=
-						(numalloc <<
-						 inode->i_sb->s_blocksize_bits);
-					numalloc = 0;
+					laarr[i].extLength -= pos;
+					numalloc = pos = 0;
 				} else {
 					numalloc -= elen;
+					pos = numalloc <<
+					      inode->i_sb->s_blocksize_bits;
 					if (*endnum > (i + 1))
 						memmove(&laarr[i],
 							&laarr[i + 1],
@@ -1039,8 +1037,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 					(*endnum)--;
 				}
 			}
-			UDF_I(inode)->i_lenExtents +=
-				numalloc << inode->i_sb->s_blocksize_bits;
+			UDF_I(inode)->i_lenExtents += pos;
 		}
 	}
 }
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ