Skip to contentSkip to conversation

no more need to check for NULL before calls to crypto_free_tfm

PATCH Herbert Xu 2 participants 2 messages Jul 18, 2005 – Jul 19, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Herbert Xu

author
#1 lore raw
Quoted 13 lines · Jesper Juhl
drivers/block/cryptoloop.c +1 -5
@@ -227,14 +227,14 @@ cryptoloop_ioctl(struct loop_device *lo,
 static int
 cryptoloop_release(struct loop_device *lo)
 {
-	struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data;
-	if (tfm != NULL) {
-		crypto_free_tfm(tfm);
-		lo->key_data = NULL;
-		return 0;
+	struct crypto_tfm *tfm = lo->key_data;

drivers/block/cryptoloop.c cryptoloop_ioctl(struct loop_device *lo, · line 238

Quoted 10 lines
drivers/block/cryptoloop.c +6 -2
+	if (!tfm) {
+		printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n");
+		return -EINVAL;
 	}
-	printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n");
-	return -EINVAL;
+	crypto_free_tfm(tfm);
+	lo->key_data = NULL;
+	return 0;
 }

This change looks rather pointless.

The rest of the patch looks good.

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 18 lines · Herbert Xu
Quoted 17 lines · Jesper Juhl
drivers/block/cryptoloop.c 2005-07-16 23:35:55.000000000 +0200 renamed from drivers/block/cryptoloop.c 2005-06-17 21:48:29.000000000 +0200 +4 -5
@@ -227,14 +227,14 @@ cryptoloop_ioctl(struct loop_device *lo,
 static int
 cryptoloop_release(struct loop_device *lo)
 {
-     struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data;
-     if (tfm != NULL) {
-             crypto_free_tfm(tfm);
-             lo->key_data = NULL;
-             return 0;
+     struct crypto_tfm *tfm = lo->key_data;
+     if (!tfm) {
+             printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n");
+             return -EINVAL;
      }
Quoted 9 lines

drivers/block/cryptoloop.c 2005-07-16 23:35:55.000000000 +0200 cryptoloop_ioctl(struct loop_device *lo, · line 238

Quoted 6 lines
drivers/block/cryptoloop.c 2005-07-16 23:35:55.000000000 +0200 renamed from drivers/block/cryptoloop.c 2005-06-17 21:48:29.000000000 +0200 +3 -2
-     printk(KERN_ERR "cryptoloop_release(): tfm == NULL?\n");
-     return -EINVAL;
+     crypto_free_tfm(tfm);
+     lo->key_data = NULL;
+     return 0;
 }

This change looks rather pointless.

Hmm, I guess you're right. Dunno why I reordered that, but you are right, it's pretty pointless. Except for getting rid of the cast, that makes sense, it's superfluous so it should go away...

Quoted 3 lines

The rest of the patch looks good.

Thanks,

You're welcome. Thank you for reviewing it.

Signature · 3 lines
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html