linux/drivers/net/wireless/intel
Gustavo A. R. Silva 83ea00d687 iwlwifi: mvm: d3: 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;
        void *entry[];
};

instance = kzalloc(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 = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-12-20 09:10:26 +02:00
..
ipw2x00 ipw2x00: cleanup dead code 2018-12-20 08:50:11 +02:00
iwlegacy iwlegacy: fix small typo 2018-11-06 19:04:36 +02:00
iwlwifi iwlwifi: mvm: d3: use struct_size() in kzalloc() 2018-12-20 09:10:26 +02:00
Kconfig net/wireless: fix spaces and grammar copy/paste in vendor Kconfig help text 2018-03-13 18:52:25 +02:00
Makefile