Commit 7cc6dfd0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

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: 9a69f508 ("drivers/staging: Gasket driver framework + Apex driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 97b23455
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment