]> git.baikalelectronics.ru Git - kernel.git/commit
drbd: fifo_alloc() should use struct_size
authorStephen Kitt <steve@sk2.org>
Fri, 24 Jan 2020 20:03:07 +0000 (21:03 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Jan 2020 04:03:33 +0000 (21:03 -0700)
commitd6d865c81b91d952afff85dc20851484f10a0e2b
tree6c1e771042b2d7bbcbb08c61a0baef104ddf8b35
parent481cf6f829a43e6fc9ac703672fbe0e55814b869
drbd: fifo_alloc() should use struct_size

Switching to struct_size for the allocation in fifo_alloc avoids
hard-coding the type of fifo_buffer.values in fifo_alloc. It also
provides overflow protection; to avoid pessimistic code being
generated by the compiler as a result, this patch also switches
fifo_size to unsigned, propagating the change as appropriate.

Reviewed-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Stephen Kitt <steve@sk2.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_nl.c
drivers/block/drbd/drbd_receiver.c
drivers/block/drbd/drbd_worker.c