projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5f1c56b
)
dm crypt: use struct_size() when allocating encryption context
author
Zhengyuan Liu
<liuzhengyuan@kylinos.cn>
Wed, 12 Jun 2019 06:14:45 +0000
(14:14 +0800)
committer
Mike Snitzer
<snitzer@redhat.com>
Tue, 9 Jul 2019 18:08:40 +0000
(14:08 -0400)
Use struct_size() to avoid open-coded equivalent that is prone to a type
mistake.
Signed-off-by: Zhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-crypt.c
patch
|
blob
|
history
diff --git
a/drivers/md/dm-crypt.c
b/drivers/md/dm-crypt.c
index 1b16d34bb78518a1849aa331c6da2ac1da0e8586..2587e94b05114757df520bc1b630f2fa78a1c085 100644
(file)
--- a/
drivers/md/dm-crypt.c
+++ b/
drivers/md/dm-crypt.c
@@
-2699,7
+2699,7
@@
static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
return -EINVAL;
}
- cc = kzalloc(s
izeof(*cc) + key_size * sizeof(u8
), GFP_KERNEL);
+ cc = kzalloc(s
truct_size(cc, key, key_size
), GFP_KERNEL);
if (!cc) {
ti->error = "Cannot allocate encryption context";
return -ENOMEM;