Re: [PATCH 4.9] iio:buffer: make length types match kfifo types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 18, 2018 at 08:58:27PM +0100, Ben Hutchings wrote:
> From: Martin Kelly <mkelly@xxxxxxxx>
> 
> 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@xxxxxxxx>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> [bwh: Backported to 4.9:
>  - Drop change to iio_dma_buffer_set_length()
>  - Adjust filename, context]
> Signed-off-by: Ben Hutchings <ben.hutchings@xxxxxxxxxxxxxxx>
> ---
>  drivers/iio/buffer/kfifo_buf.c | 4 ++--
>  include/linux/iio/buffer.h     | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)

Thanks for this and the 4.4 backport, now queued up.

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux