]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - crypto/xts.c
drm/amdgpu: fix gpu reset crash
[karo-tx-linux.git] / crypto / xts.c
index baeb34dd8582ebd11473ebb8e2ed5eadd7d2f71b..c976bfac29da526844f6a5578fea1455945c26f3 100644 (file)
@@ -230,8 +230,11 @@ static int init_crypt(struct skcipher_request *req, crypto_completion_t done)
 
        subreq->cryptlen = XTS_BUFFER_SIZE;
        if (req->cryptlen > XTS_BUFFER_SIZE) {
-               subreq->cryptlen = min(req->cryptlen, (unsigned)PAGE_SIZE);
-               rctx->ext = kmalloc(subreq->cryptlen, gfp);
+               unsigned int n = min(req->cryptlen, (unsigned int)PAGE_SIZE);
+
+               rctx->ext = kmalloc(n, gfp);
+               if (rctx->ext)
+                       subreq->cryptlen = n;
        }
 
        rctx->src = req->src;