Skip to contentSkip to conversation

ext2: remove redundant assignment to pointer end

PATCH In review Colin Ian King 2 participants 2 messages Mar 17, 2023 – Mar 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext2: remove redundant assignment to pointer end

Pointer is assigned a value that is never read, the assignment is redundant and can be removed.

Cleans up clang-scan warning:
fs/ext2/xattr.c:555:3: warning: Value stored to 'end' is never read [deadcode.DeadStores]

                end = (char *)header + sb->s_blocksize;
---
 fs/ext2/xattr.c | 1 -
 1 file changed, 1 deletion(-)
fs/ext2/xattr.c +0 -1
index b126af5f8b15..8906ba479aaf 100644
@@ -552,7 +552,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
 		error = -ENOMEM;
 		if (header == NULL)
 			goto cleanup;
-		end = (char *)header + sb->s_blocksize;
 		header->h_magic = cpu_to_le32(EXT2_XATTR_MAGIC);
 		header->h_blocks = header->h_refcount = cpu_to_le32(1);
 		last = here = ENTRY(header+1);
Signature · 1 line
2.30.2
#1 lore raw
Quoted 8 lines · Colin Ian King

Pointer is assigned a value that is never read, the assignment is redundant and can be removed.

Cleans up clang-scan warning:
fs/ext2/xattr.c:555:3: warning: Value stored to 'end' is never read [deadcode.DeadStores]

                end = (char *)header + sb->s_blocksize;

Thanks. I've picked the patch to my tree.

Honza

Quoted 19 lines
---
 fs/ext2/xattr.c | 1 -
 1 file changed, 1 deletion(-)
fs/ext2/xattr.c +0 -1
index b126af5f8b15..8906ba479aaf 100644
@@ -552,7 +552,6 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
 		error = -ENOMEM;
 		if (header == NULL)
 			goto cleanup;
-		end = (char *)header + sb->s_blocksize;
 		header->h_magic = cpu_to_le32(EXT2_XATTR_MAGIC);
 		header->h_blocks = header->h_refcount = cpu_to_le32(1);
 		last = here = ENTRY(header+1);
Signature · 1 line
2.30.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR