Skip to contentSkip to conversation

ecryptfs: re-order a condition for static checkers

PATCH Tyler Hicks 1 participant 1 message Jan 29, 2019 Kernel janitors

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · Dan Carpenter

Can we merge this patch? KASAN will probably complain about this as well, I think...

Yes, my apologies for the way too long delay. I just noticed that there's another commit of yours that I left sitting in the ecryptfs next branch from last year and never pushed it up. I'll get both commits in and will return to keeping a better eye on ecryptfs submissions.

Thanks!

Tyler

Quoted 27 lines

regards,
dan carpenter

Quoted 22 lines · Dan Carpenter

Static checkers complain that we are using "s->i" as an offset before we check whether it is within bounds. It doesn't matter much but we can easily swap the order of the checks to make everyone happy.

fs/ecryptfs/keystore.c +3 -2
index e74fe84d0886..624ff4409c61 100644
@@ -1063,8 +1063,9 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *filename_size,
 		       "rc = [%d]\n", __func__, rc);
 		goto out_free_unlock;
 	}
-	while (s->decrypted_filename[s->i] != '\0'
-	       && s->i < s->block_aligned_filename_size)
+
+	while (s->i < s->block_aligned_filename_size &&
+	       s->decrypted_filename[s->i] != '\0')
 		s->i++;
 	if (s->i = s->block_aligned_filename_size) {
 		printk(KERN_WARNING "%s: Invalid tag 70 packet; could not "