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>
This commit is contained in:
Dan Carpenter
2018-07-06 11:38:25 +03:00
committed by Alex Van Damme
parent c8bfb85d08
commit 85a2ab89f4

View File

@@ -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;