diff options
author | Xiu Jianfeng <xiujianfeng@huawei.com> | 2021-12-02 15:35:33 +0800 |
---|---|---|
committer | Paul Moore <paul@paul-moore.com> | 2021-12-05 21:58:32 -0500 |
commit | 5fe375728983b3fca6b958434a2e3f547bbbb2aa (patch) | |
tree | c42049f41c07ecb134db22c7640d8bc4853c54c9 /security/selinux/ss | |
parent | 6326948f940dc3f77066d5cdc44ba6afe67830c0 (diff) |
selinux: Use struct_size() helper in kmalloc()
Make use of struct_size() helper instead of an open-coded calculation.
Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security/selinux/ss')
-rw-r--r-- | security/selinux/ss/sidtab.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c index 656d50b09f76..293ec048af08 100644 --- a/security/selinux/ss/sidtab.c +++ b/security/selinux/ss/sidtab.c @@ -570,7 +570,7 @@ void sidtab_sid2str_put(struct sidtab *s, struct sidtab_entry *entry, goto out_unlock; } - cache = kmalloc(sizeof(struct sidtab_str_cache) + str_len, GFP_ATOMIC); + cache = kmalloc(struct_size(cache, str, str_len), GFP_ATOMIC); if (!cache) goto out_unlock; |