Skip to contentSkip to conversation

ecryptfs: remove check for if an array is NULL

PATCH In review Dan Carpenter 2 participants 2 messages Jul 31, 2013 – Sep 7, 2013

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

PATCH 1/1 ecryptfs: remove check for if an array is NULL

It doesn't make sense to check if an array is NULL. The compiler just removes the check.

---
Or perhaps "if (!strlen(crypt_stat->cipher))" was intended? I'm not very familiar with this code.

fs/ecryptfs/crypto.c +0 -4
index d107576..3bd35e2 100644
@@ -609,10 +609,6 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
 	char *full_alg_name;
 	int rc = -EINVAL;
 
-	if (!crypt_stat->cipher) {
-		ecryptfs_printk(KERN_ERR, "No cipher specified\n");
-		goto out;
-	}
 	ecryptfs_printk(KERN_DEBUG,
 			"Initializing cipher [%s]; strlen = [%d]; "
 			"key_size_bits = [%zd]\n",
#1 lore raw
Quoted 4 lines · Dan Carpenter

It doesn't make sense to check if an array is NULL. The compiler just removes the check.

Thanks, Dan!

I've pushed this to my next branch and it will be part of a pull request that should go out early next week.

Tyler

Quoted 19 lines

---
Or perhaps "if (!strlen(crypt_stat->cipher))" was intended? I'm not very familiar with this code.

fs/ecryptfs/crypto.c +0 -4
index d107576..3bd35e2 100644
@@ -609,10 +609,6 @@ int ecryptfs_init_crypt_ctx(struct ecryptfs_crypt_stat *crypt_stat)
 	char *full_alg_name;
 	int rc = -EINVAL;
 
-	if (!crypt_stat->cipher) {
-		ecryptfs_printk(KERN_ERR, "No cipher specified\n");
-		goto out;
-	}
 	ecryptfs_printk(KERN_DEBUG,
 			"Initializing cipher [%s]; strlen = [%d]; "
 			"key_size_bits = [%zd]\n",