mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 10:11:52 -04:00
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: 9a69f5087c ("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:
committed by
Greg Kroah-Hartman
parent
97b23455cc
commit
7cc6dfd076
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user