[ This code is 10 years old now. This is from an unreleased Smatch check. We moved the files around recently so these showed up as new warnings and I was just curious what was going on. - dan ] The patch 42873b0a282a: "CIFS: Respect epoch value from create lease context v2" from Sep 5, 2013, leads to the following Smatch static checker warning: fs/smb/client/smb2ops.c:4106 smb3_set_oplock_level() warn: unsigned subtraction: 'epoch - cinode->epoch' use '!=' fs/smb/client/smb2ops.c:4115 smb3_set_oplock_level() warn: unsigned subtraction: 'epoch - cinode->epoch' use '!=' fs/smb/client/smb2ops.c:4119 smb3_set_oplock_level() warn: unsigned subtraction: 'epoch - cinode->epoch' use '!=' fs/smb/client/smb2ops.c 4095 static void 4096 smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, 4097 unsigned int epoch, bool *purge_cache) 4098 { 4099 unsigned int old_oplock = cinode->oplock; 4100 4101 smb21_set_oplock_level(cinode, oplock, epoch, purge_cache); 4102 4103 if (purge_cache) { 4104 *purge_cache = false; 4105 if (old_oplock == CIFS_CACHE_READ_FLG) { --> 4106 if (cinode->oplock == CIFS_CACHE_READ_FLG && 4107 (epoch - cinode->epoch > 0)) "epoch" is zero for a new file. I guess for an existing file they would be the modification time or something? These values are unsigned so this is the equivalent of: if (epoch != cinode->epoch) Do we care about greater than less than or just not equal? 4108 *purge_cache = true; 4109 else if (cinode->oplock == CIFS_CACHE_RH_FLG && 4110 (epoch - cinode->epoch > 1)) 4111 *purge_cache = true; 4112 else if (cinode->oplock == CIFS_CACHE_RHW_FLG && 4113 (epoch - cinode->epoch > 1)) 4114 *purge_cache = true; 4115 else if (cinode->oplock == 0 && 4116 (epoch - cinode->epoch > 0)) same 4117 *purge_cache = true; 4118 } else if (old_oplock == CIFS_CACHE_RH_FLG) { 4119 if (cinode->oplock == CIFS_CACHE_RH_FLG && 4120 (epoch - cinode->epoch > 0)) same 4121 *purge_cache = true; 4122 else if (cinode->oplock == CIFS_CACHE_RHW_FLG && 4123 (epoch - cinode->epoch > 1)) 4124 *purge_cache = true; 4125 } 4126 cinode->epoch = epoch; 4127 } 4128 } regards, dan carpenter