Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1492658
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 02/10] md/dm-crypt: Reduce the scope for a variable in crypt_alloc_tfms() |
| Date | 2016-09-28 17:40 +0200 |
| Message-ID | <smp7I-7L-29@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <smp7H-7L-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 28 Sep 2016 14:05:25 +0200
Move the definition for the variable "err" (including its declaration)
into an if branch (so that the corresponding setting will only be performed
if a call of the function "crypto_alloc_skcipher" failed as before
this refactoring).
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/md/dm-crypt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 68971a2..88a3b62 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1452,7 +1452,6 @@ static void crypt_free_tfms(struct crypt_config *cc)
static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode)
{
unsigned i;
- int err;
cc->tfms = kcalloc(cc->tfms_count, sizeof(*cc->tfms), GFP_KERNEL);
if (!cc->tfms)
@@ -1461,7 +1460,8 @@ static int crypt_alloc_tfms(struct crypt_config *cc, char *ciphermode)
for (i = 0; i < cc->tfms_count; i++) {
cc->tfms[i] = crypto_alloc_skcipher(ciphermode, 0, 0);
if (IS_ERR(cc->tfms[i])) {
- err = PTR_ERR(cc->tfms[i]);
+ int err = PTR_ERR(cc->tfms[i]);
+
crypt_free_tfms(cc);
return err;
}
--
2.10.0
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 02/10] md/dm-crypt: Reduce the scope for a variable in crypt_alloc_tfms() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-09-28 17:40 +0200
csiph-web