• Martin Kelly's avatar
    iio:buffer: make length types match kfifo types · c043ec1c
    Martin Kelly authored
    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: default avatarMartin Kelly <mkelly@xevo.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    c043ec1c
kfifo_buf.c 4.86 KB