Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99266
b: refs/heads/master
c: 136f702
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and Herbert Xu committed Jul 10, 2008
1 parent 6c2dfd4 commit 1be2d3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d069033b42b392662320f71e319296a14d57ff3a
refs/heads/master: 136f702f51a4bfa38003660768e7153823fff8a1
20 changes: 10 additions & 10 deletions trunk/drivers/crypto/hifn_795x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ static int ablkcipher_add(void *daddr, unsigned int *drestp, struct scatterlist
return -EINVAL;

while (size) {
copy = min(drest, src->length);
copy = min(drest, min(size, src->length));

saddr = kmap_atomic(sg_page(src), KM_SOFTIRQ1);
memcpy(daddr, saddr + src->offset, copy);
Expand Down Expand Up @@ -1482,7 +1482,7 @@ static int ablkcipher_walk(struct ablkcipher_request *req,
if (!IS_ALIGNED(dst->offset, HIFN_D_DST_DALIGN) ||
!IS_ALIGNED(dst->length, HIFN_D_DST_DALIGN) ||
offset) {
unsigned slen = src->length - offset;
unsigned slen = min(src->length - offset, nbytes);
unsigned dlen = PAGE_SIZE;

t = &w->cache[idx];
Expand Down Expand Up @@ -1540,7 +1540,7 @@ static int ablkcipher_walk(struct ablkcipher_request *req,

kunmap_atomic(daddr, KM_SOFTIRQ0);
} else {
nbytes -= src->length;
nbytes -= min(src->length, nbytes);
idx++;
}

Expand All @@ -1559,7 +1559,7 @@ static int hifn_setup_session(struct ablkcipher_request *req)
struct hifn_context *ctx = crypto_tfm_ctx(req->base.tfm);
struct hifn_device *dev = ctx->dev;
struct page *spage, *dpage;
unsigned long soff, doff, flags;
unsigned long soff, doff, dlen, flags;
unsigned int nbytes = req->nbytes, idx = 0, len;
int err = -EINVAL, sg_num;
struct scatterlist *src, *dst, *t;
Expand All @@ -1571,12 +1571,13 @@ static int hifn_setup_session(struct ablkcipher_request *req)

while (nbytes) {
dst = &req->dst[idx];
dlen = min(dst->length, nbytes);

if (!IS_ALIGNED(dst->offset, HIFN_D_DST_DALIGN) ||
!IS_ALIGNED(dst->length, HIFN_D_DST_DALIGN))
!IS_ALIGNED(dlen, HIFN_D_DST_DALIGN))
ctx->walk.flags |= ASYNC_FLAGS_MISALIGNED;

nbytes -= dst->length;
nbytes -= dlen;
idx++;
}

Expand Down Expand Up @@ -1631,7 +1632,7 @@ static int hifn_setup_session(struct ablkcipher_request *req)
if (err)
goto err_out;

nbytes -= len;
nbytes -= min(len, nbytes);
}

dev->active = HIFN_DEFAULT_ACTIVE_NUM;
Expand Down Expand Up @@ -1736,8 +1737,7 @@ static int ablkcipher_get(void *saddr, unsigned int *srestp, unsigned int offset
return -EINVAL;

while (size) {

copy = min(dst->length, srest);
copy = min(srest, min(dst->length, size));

daddr = kmap_atomic(sg_page(dst), KM_IRQ0);
memcpy(daddr + dst->offset + offset, saddr, copy);
Expand Down Expand Up @@ -1794,7 +1794,7 @@ static void hifn_process_ready(struct ablkcipher_request *req, int error)
sg_page(dst), dst->length, nbytes);

if (!t->length) {
nbytes -= dst->length;
nbytes -= min(dst->length, nbytes);
idx++;
continue;
}
Expand Down

0 comments on commit 1be2d3f

Please sign in to comment.