aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/futex-contention.py
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2019-01-30 18:46:22 -0600
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-05-28 09:28:49 -0400
commit66d4218f9902132a48f29607ca741076ab3671a1 (patch)
tree874fdcd972fd5bfc3ddb0b4cd616d8425f63f5cf /tools/perf/scripts/python/futex-contention.py
parentcd6c84d8f0cdc911df435bb075ba22ce3c605b07 (diff)
xprtrdma: Use struct_size() in kzalloc()
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 foo { int stuff; struct boo entry[]; }; instance = kzalloc(sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL); This code was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'tools/perf/scripts/python/futex-contention.py')
0 files changed, 0 insertions, 0 deletions