]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iio:buffer: make length types match kfifo types
authorMartin Kelly <mkelly@xevo.com>
Mon, 26 Mar 2018 21:27:51 +0000 (14:27 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 5 Sep 2018 08:30:45 +0000 (10:30 +0200)
commit832521b82df17e4547468ee0d42b3c2e7c46250b
tree5b5cc3caff886377514230eb863a084e069a04c4
parentefdb960ee053ee9eda2c06aeb889515fd8f725c9
iio:buffer: make length types match kfifo types

BugLink: http://bugs.launchpad.net/bugs/1788897
commit c043ec1ca5baae63726aae32abbe003192bc6eec upstream.

Currently, we use int for buffer length and bytes_per_datum. However,
kfifo uses unsigned int for length and size_t for element size. We need
to make sure these matches or we will have bugs related to overflow (in
the range between INT_MAX and UINT_MAX for length, for example).

In addition, set_bytes_per_datum uses size_t while bytes_per_datum is an
int, which would cause bugs for large values of bytes_per_datum.

Change buffer length to use unsigned int and bytes_per_datum to use
size_t.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/iio/buffer/industrialio-buffer-dma.c
drivers/iio/buffer/kfifo_buf.c
include/linux/iio/buffer_impl.h