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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1483736083-25193-2-git-send-email-fabf@skynet.be>
Date:   Fri,  6 Jan 2017 21:54:42 +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 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0

Use easier and more explicit value

Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 fs/udf/balloc.c    |  6 +++---
 fs/udf/misc.c      |  6 +++---
 fs/udf/partition.c | 20 ++++++++++----------
 fs/udf/super.c     | 26 +++++++++++++-------------
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index e0fd65f..fd760e4 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -511,7 +511,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
 	epos.offset = sizeof(struct unallocSpaceEntry);
 	epos.block = iinfo->i_location;
 	epos.bh = NULL;
-	eloc.logicalBlockNum = 0xFFFFFFFF;
+	eloc.logicalBlockNum = ~0;
 
 	while (first_block != eloc.logicalBlockNum &&
 	       (etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
@@ -550,7 +550,7 @@ static int udf_table_new_block(struct super_block *sb,
 			       uint32_t goal, int *err)
 {
 	struct udf_sb_info *sbi = UDF_SB(sb);
-	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
+	uint32_t spread = ~0, nspread = ~0;
 	uint32_t newblock = 0, adsize;
 	uint32_t elen, goal_elen = 0;
 	struct kernel_lb_addr eloc, uninitialized_var(goal_eloc);
@@ -609,7 +609,7 @@ static int udf_table_new_block(struct super_block *sb,
 
 	brelse(epos.bh);
 
-	if (spread == 0xFFFFFFFF) {
+	if (spread == ~0) {
 		brelse(goal_epos.bh);
 		mutex_unlock(&sbi->s_alloc_mutex);
 		return 0;
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 3949c4b..8c70f134 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -94,8 +94,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
 					cpu_to_le16(sbi->s_serial_number);
 			eahd->descTag.tagLocation = cpu_to_le32(
 					iinfo->i_location.logicalBlockNum);
-			eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF);
-			eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF);
+			eahd->impAttrLocation = cpu_to_le32(~0);
+			eahd->appAttrLocation = cpu_to_le32(~0);
 		}
 
 		offset = iinfo->i_lenEAttr;
@@ -204,7 +204,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
 	u8 checksum;
 
 	/* Read the block */
-	if (block == 0xFFFFFFFF)
+	if (block == ~0)
 		return NULL;
 
 	bh = udf_tread(sb, block);
diff --git a/fs/udf/partition.c b/fs/udf/partition.c
index 888c364..f8658e9 100644
--- a/fs/udf/partition.c
+++ b/fs/udf/partition.c
@@ -34,7 +34,7 @@ uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
 	if (partition >= sbi->s_partitions) {
 		udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n",
 			  block, partition, offset);
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 	map = &sbi->s_partmaps[partition];
 	if (map->s_partition_func)
@@ -61,7 +61,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
 	if (block > vdata->s_num_entries) {
 		udf_debug("Trying to access block beyond end of VAT (%d max %d)\n",
 			  block, vdata->s_num_entries);
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
@@ -85,7 +85,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
 	if (!bh) {
 		udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%d,%d) VAT: %d[%d]\n",
 			  sb, block, partition, loc, index);
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 
 	loc = le32_to_cpu(((__le32 *)bh->b_data)[index]);
@@ -95,7 +95,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
 translate:
 	if (iinfo->i_location.partitionReferenceNum == partition) {
 		udf_debug("recursive call to udf_get_pblock!\n");
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 
 	return udf_get_pblock(sb, loc,
@@ -188,7 +188,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
 				struct sparingEntry *entry = &st->mapEntry[k];
 				u32 origLoc = le32_to_cpu(entry->origLocation);
 
-				if (origLoc == 0xFFFFFFFF) {
+				if (origLoc == ~0) {
 					for (; j < 4; j++) {
 						int len;
 						bh = sdata->s_spar_map[j];
@@ -229,7 +229,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
 				struct sparingEntry *entry = &st->mapEntry[l];
 				u32 origLoc = le32_to_cpu(entry->origLocation);
 
-				if (origLoc != 0xFFFFFFFF)
+				if (origLoc != ~0)
 					continue;
 
 				for (; j < 4; j++) {
@@ -290,7 +290,7 @@ static uint32_t udf_try_read_meta(struct inode *inode, uint32_t block,
 
 	if (inode_bmap(inode, block, &epos, &eloc, &elen, &ext_offset) !=
 						(EXT_RECORDED_ALLOCATED >> 30))
-		phyblock = 0xFFFFFFFF;
+		phyblock = ~0;
 	else {
 		map = &UDF_SB(sb)->s_partmaps[partition];
 		/* map to sparable/physical partition desc */
@@ -319,10 +319,10 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 	inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe;
 
 	if (!inode)
-		return 0xFFFFFFFF;
+		return ~0;
 
 	retblk = udf_try_read_meta(inode, block, partition, offset);
-	if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) {
+	if (retblk == ~0 && mdata->s_metadata_fe) {
 		udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n");
 		if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) {
 			mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb,
@@ -335,7 +335,7 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 
 		inode = mdata->s_mirror_fe;
 		if (!inode)
-			return 0xFFFFFFFF;
+			return ~0;
 		retblk = udf_try_read_meta(inode, block, partition, offset);
 	}
 
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 6b5a1a4..3a3d307 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -492,12 +492,12 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
 
 	uopt->novrs = 0;
 	uopt->partition = 0xFFFF;
-	uopt->session = 0xFFFFFFFF;
+	uopt->session = ~0;
 	uopt->lastblock = 0;
 	uopt->anchor = 0;
-	uopt->volume = 0xFFFFFFFF;
-	uopt->rootdir = 0xFFFFFFFF;
-	uopt->fileset = 0xFFFFFFFF;
+	uopt->volume = ~0;
+	uopt->rootdir = ~0;
+	uopt->fileset = ~0;
 	uopt->nls_map = NULL;
 
 	if (!options)
@@ -803,7 +803,7 @@ static int udf_find_fileset(struct super_block *sb,
 	uint16_t ident;
 	struct udf_sb_info *sbi;
 
-	if (fileset->logicalBlockNum != 0xFFFFFFFF ||
+	if (fileset->logicalBlockNum != ~0 ||
 	    fileset->partitionReferenceNum != 0xFFFF) {
 		bh = udf_read_ptagged(sb, fileset, 0, &ident);
 
@@ -826,7 +826,7 @@ static int udf_find_fileset(struct super_block *sb,
 
 		for (newfileset.partitionReferenceNum = sbi->s_partitions - 1;
 		     (newfileset.partitionReferenceNum != 0xFFFF &&
-		      fileset->logicalBlockNum == 0xFFFFFFFF &&
+		      fileset->logicalBlockNum == ~0 &&
 		      fileset->partitionReferenceNum == 0xFFFF);
 		     newfileset.partitionReferenceNum--) {
 			lastblock = sbi->s_partmaps
@@ -865,12 +865,12 @@ static int udf_find_fileset(struct super_block *sb,
 					break;
 				}
 			} while (newfileset.logicalBlockNum < lastblock &&
-				 fileset->logicalBlockNum == 0xFFFFFFFF &&
+				 fileset->logicalBlockNum == ~0 &&
 				 fileset->partitionReferenceNum == 0xFFFF);
 		}
 	}
 
-	if ((fileset->logicalBlockNum != 0xFFFFFFFF ||
+	if ((fileset->logicalBlockNum != ~0 ||
 	     fileset->partitionReferenceNum != 0xFFFF) && bh) {
 		udf_debug("Fileset at block=%d, partition=%d\n",
 			  fileset->logicalBlockNum,
@@ -1012,7 +1012,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition,
 	 * Note:
 	 * Load only if bitmap file location differs from 0xFFFFFFFF (DCN-5102)
 	*/
-	if (mdata->s_bitmap_file_loc != 0xFFFFFFFF) {
+	if (mdata->s_bitmap_file_loc != ~0) {
 		addr.logicalBlockNum = mdata->s_bitmap_file_loc;
 		addr.partitionReferenceNum = mdata->s_phys_partition_ref;
 
@@ -2076,7 +2076,7 @@ u64 lvid_get_unique_id(struct super_block *sb)
 
 	mutex_lock(&sbi->s_alloc_mutex);
 	ret = uniqueID = le64_to_cpu(lvhd->uniqueID);
-	if (!(++uniqueID & 0xFFFFFFFF))
+	if (!(++uniqueID & ~0))
 		uniqueID += 16;
 	lvhd->uniqueID = cpu_to_le64(uniqueID);
 	mutex_unlock(&sbi->s_alloc_mutex);
@@ -2129,7 +2129,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 	if (!(uopt.flags & (1 << UDF_FLAG_NLS_MAP)))
 		uopt.flags |= (1 << UDF_FLAG_UTF8);
 
-	fileset.logicalBlockNum = 0xFFFFFFFF;
+	fileset.logicalBlockNum = ~0;
 	fileset.partitionReferenceNum = 0xFFFF;
 
 	sbi->s_flags = uopt.flags;
@@ -2141,7 +2141,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 	sbi->s_nls_map = uopt.nls_map;
 	rwlock_init(&sbi->s_cred_lock);
 
-	if (uopt.session == 0xFFFFFFFF)
+	if (uopt.session == ~0)
 		sbi->s_session = udf_get_last_session(sb);
 	else
 		sbi->s_session = uopt.session;
@@ -2467,7 +2467,7 @@ static unsigned int udf_count_free(struct super_block *sb)
 		if (le32_to_cpu(lvid->numOfPartitions) > sbi->s_partition) {
 			accum = le32_to_cpu(
 					lvid->freeSpaceTable[sbi->s_partition]);
-			if (accum == 0xFFFFFFFF)
+			if (accum == ~0)
 				accum = 0;
 		}
 	}
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ