2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2025-01-24 22:55:35 +08:00
linux-next/drivers/net/wireless/quantenna/qtnfmac
Gustavo A. R. Silva 95336d4cb5 qtnfmac: replace qtnf_cmd_acl_data_size() with struct_size()
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[];
};

size = sizeof(struct foo) + count * sizeof(struct boo);
instance = kzalloc(size, GFP_KERNEL)

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

size = struct_size(instance, entry, count);

or

instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL)

Based on the above, replace qtnf_cmd_acl_data_size() with the
new struct_size() helper.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-04-04 19:38:36 +03:00
..
pcie qtnfmac: send EAPOL frames via control path 2019-04-04 12:57:33 +03:00
bus.h qtnfmac: send EAPOL frames via control path 2019-04-04 12:57:33 +03:00
cfg80211.c qtnfmac: send EAPOL frames via control path 2019-04-04 12:57:33 +03:00
cfg80211.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
commands.c qtnfmac: replace qtnf_cmd_acl_data_size() with struct_size() 2019-04-04 19:38:36 +03:00
commands.h qtnfmac: send EAPOL frames via control path 2019-04-04 12:57:33 +03:00
core.c qtnfmac: send EAPOL frames via control path 2019-04-04 12:57:33 +03:00
core.h qtnfmac: send EAPOL frames via control path 2019-04-04 12:57:33 +03:00
debug.c qtnfmac: no need to check return value of debugfs_create functions 2019-02-01 14:34:13 +02:00
debug.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
event.c qtnfmac: enable WPA3 SAE support 2019-02-08 17:30:24 +02:00
event.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
Kconfig qtnfmac: add support for Topaz chipsets 2018-11-06 18:53:50 +02:00
Makefile qtnfmac: add support for Topaz chipsets 2018-11-06 18:53:50 +02:00
qlink_util.c qtnfmac: allow each MAC to specify its own regulatory rules 2019-04-04 12:57:28 +03:00
qlink_util.h qtnfmac: allow each MAC to specify its own regulatory rules 2019-04-04 12:57:28 +03:00
qlink.h qtnfmac: use scan duration param for different scan types 2019-04-04 12:57:34 +03:00
qtn_hw_ids.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
shm_ipc_defs.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
shm_ipc.c qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
shm_ipc.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
trans.c qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
trans.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
util.c qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00
util.h qtnfmac: convert to SPDX license identifiers 2019-02-01 14:12:02 +02:00