KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
82 stars 5 forks source link

Address -Warray-bounds issue in drivers/iio/proximity/irsd200.c #331

Closed GustavoARSilva closed 8 months ago

GustavoARSilva commented 1 year ago

Found in X86_64 (allmodconfig):

include/linux/iio/buffer.h:42:46: warning: array subscript 'int64_t {aka long long int}[0]' is partly outside array bounds of 's16[1]' {aka 'short int[1]'} [-Warray-bounds=]
drivers/iio/proximity/irsd200.c:
758 static irqreturn_t irsd200_trigger_handler(int irq, void *pollf)
759 {
760         struct iio_dev *indio_dev = ((struct iio_poll_func *)pollf)->indio_dev;
761         struct irsd200_data *data = iio_priv(indio_dev);
@762         s16 buf = 0;
763         int ret;
764 
765         ret = irsd200_read_data(data, &buf);
766         if (ret)
767                 goto end;
768 
@769         iio_push_to_buffers_with_timestamp(indio_dev, &buf,
770                                            iio_get_time_ns(indio_dev));
771 
772 end:
773         iio_trigger_notify_done(indio_dev->trig);
774 
775         return IRQ_HANDLED;
776 }
kees commented 8 months ago

Fixed in commit ea191d0fd361fb569b6c3d19e5410510aa6b6bac.