linux/drivers/infiniband/hw
Gustavo A. R. Silva 02fc184841 IB/usnic: Use struct_size() in kmalloc()
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;
    void *entry[];
};

instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = kmalloc(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>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2019-01-07 11:43:03 -07:00
..
bnxt_re infiniband: bnxt_re: qplib: Check the return value of send_message 2019-01-02 16:04:24 -07:00
cxgb3 RDMA: Cleanup undesired pd->uobject usage 2018-12-18 19:15:48 -07:00
cxgb4 4.21 merge window pull request 2018-12-28 14:57:10 -08:00
hfi1 Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
hns RDMA: Mark if destroy address handle is in a sleepable context 2018-12-19 16:28:03 -07:00
i40iw 4.21 merge window pull request 2018-12-28 14:57:10 -08:00
mlx4 4.21 merge window pull request 2018-12-28 14:57:10 -08:00
mlx5 Revert "IB/mlx5: Fix long EEH recover time with NVMe offloads" 2019-01-02 09:40:34 -07:00
mthca RDMA: Mark if destroy address handle is in a sleepable context 2018-12-19 16:28:03 -07:00
nes 4.21 merge window pull request 2018-12-28 14:57:10 -08:00
ocrdma RDMA: Mark if destroy address handle is in a sleepable context 2018-12-19 16:28:03 -07:00
qedr infiniband/qedr: Potential null ptr dereference of qp 2019-01-02 16:08:38 -07:00
qib Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
usnic IB/usnic: Use struct_size() in kmalloc() 2019-01-07 11:43:03 -07:00
vmw_pvrdma RDMA: Mark if destroy address handle is in a sleepable context 2018-12-19 16:28:03 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00