Gustavo A. R. Silva
211f70ff1d
scsi: virtio_scsi: Use struct_size() helper
...
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 virtio_scsi {
...
struct virtio_scsi_vq req_vqs[];
};
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
So, replace the following form:
sizeof(*vscsi) + sizeof(vscsi->req_vqs[0]) * num_queues
with:
struct_size(vscsi, req_vqs, num_queues)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com >
Signed-off-by: Michael S. Tsirkin <mst@redhat.com >
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com >
2019-07-11 16:06:39 -04:00
..
2019-05-24 17:36:47 +02:00
2019-05-24 11:03:26 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:03 +02:00
2019-05-24 17:27:11 +02:00
2019-05-15 08:46:44 -07:00
2019-05-24 17:37:53 +02:00
2019-05-05 19:34:00 +02:00
2019-05-16 09:19:14 -07:00
2019-05-21 11:28:39 +02:00
2019-05-26 08:30:16 -07:00
2019-05-21 11:28:47 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:02 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 12:33:38 -07:00
2019-05-25 10:11:23 -07:00
2019-05-24 17:27:11 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:27:12 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:36:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:01 +02:00
2019-05-24 14:31:58 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-04-13 09:36:35 -04:00
2019-05-24 17:39:02 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:01 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:36:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:36:47 +02:00
2019-05-21 12:33:38 -07:00
2019-05-24 17:36:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-06 17:32:14 -04:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:40 +02:00
2019-05-24 17:37:53 +02:00
2019-05-24 17:37:52 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:02 +02:00
2019-05-21 11:28:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-25 10:11:23 -07:00
2019-05-24 17:39:03 +02:00
2019-05-24 17:36:45 +02:00
2019-05-21 11:28:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:36:45 +02:00
2019-05-24 17:39:02 +02:00
2019-05-24 14:31:58 -07:00
2019-05-24 17:39:00 +02:00
2019-05-24 14:31:58 -07:00
2019-05-24 17:39:03 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-25 10:11:23 -07:00
2019-05-24 16:02:14 -07:00
2019-05-21 10:50:46 +02:00
2019-06-06 17:32:13 -04:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-06 17:32:13 -04:00
2019-05-21 10:50:46 +02:00
2019-05-22 08:36:16 -07:00
2019-05-24 17:39:02 +02:00
2019-05-21 11:28:45 +02:00
2019-05-24 14:31:58 -07:00
2019-05-24 17:39:02 +02:00
2019-05-21 11:28:39 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:36:45 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:36:45 +02:00
2019-05-24 17:39:02 +02:00
2019-05-21 11:28:40 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:01 +02:00
2019-05-20 15:02:08 -07:00
2019-05-24 17:36:45 +02:00
2019-07-11 16:06:39 -04:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-04-25 22:23:06 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:27:12 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-23 21:58:25 -07:00
2019-05-21 10:50:46 +02:00
2019-05-19 09:56:36 -07:00
2019-05-24 17:36:45 +02:00
2019-05-18 11:49:57 +09:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-06 17:32:13 -04:00
2019-05-24 17:36:47 +02:00
2019-05-21 10:50:46 +02:00
2019-05-27 11:08:22 -04:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:39:00 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:37:53 +02:00
2019-05-24 17:36:45 +02:00
2019-05-24 17:37:51 +02:00
2019-05-21 10:50:46 +02:00
2019-04-25 21:33:37 +02:00
2019-04-25 21:33:37 +02:00