diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-07-06 11:38:25 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-06 17:35:42 +0200 |
commit | 7cc6dfd076e84359a96a851c41ac8dc696565a3f (patch) | |
tree | 768e4fec10d38fb95ee849953031ee639142cef6 /drivers/staging/gasket/gasket_interrupt.c | |
parent | 97b23455ccd53a632585d0fd06ff9d30877c810a (diff) |
Staging: Gasket: fix a couple off by one bugs
The > should be >= or we end up writing one element beyond the end of
the interrupt_data->eventfd_ctxs[] array.
Fixes: 9a69f5087ccc ("drivers/staging: Gasket driver framework + Apex driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gasket/gasket_interrupt.c')
-rw-r--r-- | drivers/staging/gasket/gasket_interrupt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/gasket/gasket_interrupt.c b/drivers/staging/gasket/gasket_interrupt.c index 1fd7bee5db2f..d1461b36f091 100644 --- a/drivers/staging/gasket/gasket_interrupt.c +++ b/drivers/staging/gasket/gasket_interrupt.c @@ -514,7 +514,7 @@ int gasket_interrupt_set_eventfd( if (IS_ERR(ctx)) return PTR_ERR(ctx); - if (interrupt < 0 || interrupt > interrupt_data->num_interrupts) + if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) return -EINVAL; interrupt_data->eventfd_ctxs[interrupt] = ctx; @@ -524,7 +524,7 @@ int gasket_interrupt_set_eventfd( int gasket_interrupt_clear_eventfd( struct gasket_interrupt_data *interrupt_data, int interrupt) { - if (interrupt < 0 || interrupt > interrupt_data->num_interrupts) + if (interrupt < 0 || interrupt >= interrupt_data->num_interrupts) return -EINVAL; interrupt_data->eventfd_ctxs[interrupt] = NULL; |