Commit b81d6cf79b57f6123a5d4f7a4932cc359995484d

Authored by Johannes Weiner
Committed by Alasdair G Kergon
1 parent 45194e4f89

dm crypt: use kzfree

Use kzfree() instead of memset() + kfree().

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

Showing 1 changed file with 2 additions and 4 deletions Side-by-side Diff

drivers/md/dm-crypt.c
... ... @@ -1156,8 +1156,7 @@
1156 1156 crypto_free_ablkcipher(tfm);
1157 1157 bad_cipher:
1158 1158 /* Must zero key material before freeing */
1159   - memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
1160   - kfree(cc);
  1159 + kzfree(cc);
1161 1160 return -EINVAL;
1162 1161 }
1163 1162  
... ... @@ -1183,8 +1182,7 @@
1183 1182 dm_put_device(ti, cc->dev);
1184 1183  
1185 1184 /* Must zero key material before freeing */
1186   - memset(cc, 0, sizeof(*cc) + cc->key_size * sizeof(u8));
1187   - kfree(cc);
  1185 + kzfree(cc);
1188 1186 }
1189 1187  
1190 1188 static int crypt_map(struct dm_target *ti, struct bio *bio,