mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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>
This commit is contained in:
@@ -1575,7 +1575,8 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info)
|
||||
struct drbd_device *device;
|
||||
struct disk_conf *new_disk_conf, *old_disk_conf;
|
||||
struct fifo_buffer *old_plan = NULL, *new_plan = NULL;
|
||||
int err, fifo_size;
|
||||
int err;
|
||||
unsigned int fifo_size;
|
||||
|
||||
retcode = drbd_adm_prepare(&adm_ctx, skb, info, DRBD_ADM_NEED_MINOR);
|
||||
if (!adm_ctx.reply_skb)
|
||||
|
||||
Reference in New Issue
Block a user