mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] afs: delete double assignment
@ 2014-07-28 15:24 Himangi Saraogi
  2014-07-28 15:29 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-07-28 15:24 UTC (permalink / raw)
  To: David Howells, linux-afs, linux-kernel; +Cc: julia.lawall

A simplified version of Coccinelle semantic match that finds this problem is as
follows:

// <smpl>
@@
expression i;
@@

*i = ...;
 i = ...;
// </smpl>

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
Should the second assignment is each case be a |= ?
 fs/afs/main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/afs/main.c b/fs/afs/main.c
index 42dd2e4..a2f5a16 100644
--- a/fs/afs/main.c
+++ b/fs/afs/main.c
@@ -54,13 +54,10 @@ static int __init afs_get_client_UUID(void)
 	uuidtime += AFS_UUID_TO_UNIX_TIME;
 	afs_uuid.time_low = uuidtime;
 	afs_uuid.time_mid = uuidtime >> 32;
-	afs_uuid.time_hi_and_version = (uuidtime >> 48) & AFS_UUID_TIMEHI_MASK;
 	afs_uuid.time_hi_and_version = AFS_UUID_VERSION_TIME;
 
 	get_random_bytes(&clockseq, 2);
 	afs_uuid.clock_seq_low = clockseq;
-	afs_uuid.clock_seq_hi_and_reserved =
-		(clockseq >> 8) & AFS_UUID_CLOCKHI_MASK;
 	afs_uuid.clock_seq_hi_and_reserved = AFS_UUID_VARIANT_STD;
 
 	_debug("AFS UUID: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-- 
1.9.1


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

* Re: [PATCH] afs: delete double assignment
  2014-07-28 15:24 [PATCH] afs: delete double assignment Himangi Saraogi
@ 2014-07-28 15:29 ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2014-07-28 15:29 UTC (permalink / raw)
  To: Himangi Saraogi; +Cc: dhowells, linux-afs, linux-kernel, julia.lawall

Himangi Saraogi <himangi774@gmail.com> wrote:

> -	afs_uuid.time_hi_and_version = (uuidtime >> 48) & AFS_UUID_TIMEHI_MASK;
>  	afs_uuid.time_hi_and_version = AFS_UUID_VERSION_TIME;
>  
>  	get_random_bytes(&clockseq, 2);
>  	afs_uuid.clock_seq_low = clockseq;
> -	afs_uuid.clock_seq_hi_and_reserved =
> -		(clockseq >> 8) & AFS_UUID_CLOCKHI_MASK;
>  	afs_uuid.clock_seq_hi_and_reserved = AFS_UUID_VARIANT_STD;

This might be the wrong thing to do.  I wonder if the lines following the ones
deleted should be "|=" rather than "=".  I'll have a look into it.

David

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

end of thread, other threads:[~2014-07-28 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 15:24 [PATCH] afs: delete double assignment Himangi Saraogi
2014-07-28 15:29 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome