Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torvalds/linux.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2020-05-24 23:52:38 +0300
committerPaul Moore <paul@paul-moore.com>2020-06-17 23:43:11 +0300
commitbbccc11bc8848926065915e6193fd4c6e33c85ef (patch)
tree87c2225344fc30b92dd8035e1ad10947359f7545 /kernel/auditsc.c
parentb3a9e3b9622ae10064826dccb4f7a52bd88c7407 (diff)
audit: Use struct_size() helper in alloc_chunk
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct audit_chunk { ... struct node { struct list_head list; struct audit_tree *owner; unsigned index; /* index; upper bit indicates 'will prune' */ } owners[]; }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. So, replace the following form: offsetof(struct audit_chunk, owners) + count * sizeof(struct node); with: struct_size(chunk, owners, count) This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/auditsc.c')
0 files changed, 0 insertions, 0 deletions