linux_dsm_epyc7002/drivers/nvme/target
Gustavo A. R. Silva 6b80f1d2cc nvmet-fc: use zero-sized array and struct_size() in kzalloc()
Update the code to use a zero-sized array instead of a pointer in
structure nvmet_fc_tgt_queue and use struct_size() in kzalloc().

Notice that 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) + sizeof(struct boo) * 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 code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-04-05 08:07:57 +02:00
..
admin-cmd.c nvmet: convert to SPDX identifiers 2019-02-20 07:22:42 -07:00
configfs.c nvmet: convert to SPDX identifiers 2019-02-20 07:22:42 -07:00
core.c nvmet: fix error flow during ns enable 2019-03-28 18:15:03 +01:00
discovery.c nvmet: convert to SPDX identifiers 2019-02-20 07:22:42 -07:00
fabrics-cmd.c nvmet: convert to SPDX identifiers 2019-02-20 07:22:42 -07:00
fc.c nvmet-fc: use zero-sized array and struct_size() in kzalloc() 2019-04-05 08:07:57 +02:00
fcloop.c nvmet-fcloop: convert to SPDX identifiers 2019-02-20 07:22:34 -07:00
io-cmd-bdev.c nvmet: avoid double errno conversions 2019-04-05 08:07:56 +02:00
io-cmd-file.c nvmet: fix building bvec from sg list 2019-03-28 18:15:02 +01:00
Kconfig nvmet-tcp: add NVMe over TCP target driver 2018-12-13 09:58:57 +01:00
loop.c nvme-loop: convert to SPDX identifiers 2019-02-20 07:22:36 -07:00
Makefile nvmet-tcp: add NVMe over TCP target driver 2018-12-13 09:58:57 +01:00
nvmet.h nvmet: convert to SPDX identifiers 2019-02-20 07:22:42 -07:00
rdma.c nvmet-rdma: convert to SPDX identifiers 2019-02-20 07:22:39 -07:00
tcp.c nvmet-tcp: fix uninitialized variable access 2019-01-16 09:44:20 -07:00