Skip to contentSkip to conversation

ext4:memset is needless in ext4_ext_remove_space()

PATCH In review 潘卫平(Peter Pan) 3 participants 3 messages Nov 8, 2010

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

PATCH 1/1 ext4:memset is needless in ext4_ext_remove_space()

memset is needless because path is allocated by kzalloc.

---
 fs/ext4/extents.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
fs/ext4/extents.c +0 -1
index 0554c48..37cdb6e 100644
@@ -2375,7 +2375,6 @@ again:
 			/* go to the next level */
 			ext_debug("move to level %d (block %llu)\n",
 				  i + 1, ext4_idx_pblock(path[i].p_idx));
-			memset(path + i + 1, 0, sizeof(*path));
 			bh = sb_bread(sb, ext4_idx_pblock(path[i].p_idx));
 			if (!bh) {
 				/* should we reset i_size? */
Signature · 7 lines
1.6.6


--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 3 lines · 潘卫平(Peter Pan)

memset is needless because path is allocated by kzalloc.

This is inside a loop and sometimes we do i++ and sometimes i--. Are you absolutely positive that path + i isn't initialized?

I haven't followed this code through all the way but my instinct is that the memset is there for a reason.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 6 lines · Dan Carpenter

This is inside a loop and sometimes we do i++ and sometimes i--. Are you absolutely positive that path + i isn't initialized?

I haven't followed this code through all the way but my instinct is that the memset is there for a reason.

I know that I misunderstood it.

Thank you!

Regards

Peter Pan