linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e2fsprogs - dirhash.c: remove useless test and assignment in strtohash
@ 2017-07-27 20:53 Damien Guibouret
  2017-09-07 13:39 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Guibouret @ 2017-07-27 20:53 UTC (permalink / raw)
  To: linux-ext4; +Cc: Damien Guibouret

On transformation of str to hash, computed value is initialised before
first byte modulo 4. But it is already initialised before entering loop
and after processing last byte modulo 4. So the corresponding test and
initialisation could be removed.

Signed-off-by: Damien Guibouret <damien.guibouret@partition-saving.com>
---
 lib/ext2fs/dirhash.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/ext2fs/dirhash.c b/lib/ext2fs/dirhash.c
index c4ac94e..4ba3f35 100644
--- a/lib/ext2fs/dirhash.c
+++ b/lib/ext2fs/dirhash.c
@@ -154,8 +154,6 @@ static void str2hashbuf(const char *msg, int len, __u32 *buf, int num,
 	if (len > num*4)
 		len = num * 4;
 	for (i=0; i < len; i++) {
-		if ((i % 4) == 0)
-			val = pad;
 		if (unsigned_flag)
 			c = (int) ucp[i];
 		else
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: e2fsprogs - dirhash.c: remove useless test and assignment in strtohash
  2017-07-27 20:53 [PATCH] e2fsprogs - dirhash.c: remove useless test and assignment in strtohash Damien Guibouret
@ 2017-09-07 13:39 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2017-09-07 13:39 UTC (permalink / raw)
  To: Damien Guibouret; +Cc: linux-ext4

On Thu, Jul 27, 2017 at 10:53:54PM +0200, Damien Guibouret wrote:
> On transformation of str to hash, computed value is initialised before
> first byte modulo 4. But it is already initialised before entering loop
> and after processing last byte modulo 4. So the corresponding test and
> initialisation could be removed.
> 
> Signed-off-by: Damien Guibouret <damien.guibouret@partition-saving.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-09-07 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-27 20:53 [PATCH] e2fsprogs - dirhash.c: remove useless test and assignment in strtohash Damien Guibouret
2017-09-07 13:39 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).