2008-10-16 09:40:12

by Vishnu Suresh

[permalink] [raw]
Subject: [PATCH] crypto: talitos Preempt overflow interrupts off-by-one fix

In commit ec6644d6325b5a38525f1d5b20fd4bf7db05cf2a "crypto: talitos - Preempt
overflow interrupts", the test in atomic_inc_not_zero was interpreted by the
author to be applied after the increment operation (not before). This off-by-one
fix prevents overflow error interrupts from occurring when requests are frequent
and large enough to do so.

Signed-off-by: Vishnu Suresh <[email protected]>
Signed-off-by: Kim Phillips <[email protected]>
---
drivers/crypto/talitos.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 6836cb7..c2294f2 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1598,7 +1598,7 @@ static int talitos_probe(struct of_device *ofdev,
goto err_out;
}
for (i = 0; i < priv->num_channels; i++)
- atomic_set(&priv->submit_count[i], -priv->chfifo_len);
+ atomic_set(&priv->submit_count[i], -(priv->chfifo_len - 1));

priv->head = kzalloc(sizeof(int) * priv->num_channels, GFP_KERNEL);
priv->tail = kzalloc(sizeof(int) * priv->num_channels, GFP_KERNEL);
--
1.5.4



2008-10-20 13:15:59

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: talitos Preempt overflow interrupts off-by-one fix

On Thu, Oct 16, 2008 at 09:44:51AM +0000, Vishnu Suresh wrote:
> In commit ec6644d6325b5a38525f1d5b20fd4bf7db05cf2a "crypto: talitos - Preempt
> overflow interrupts", the test in atomic_inc_not_zero was interpreted by the
> author to be applied after the increment operation (not before). This off-by-one
> fix prevents overflow error interrupts from occurring when requests are frequent
> and large enough to do so.
>
> Signed-off-by: Vishnu Suresh <[email protected]>
> Signed-off-by: Kim Phillips <[email protected]>

Patch applied. Thanks!
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt