lkml.org 
[lkml]   [2021]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.4 16/40] crypto: tcrypt - avoid signed overflow in byte count
    Date
    From: Ard Biesheuvel <ardb@kernel.org>

    [ Upstream commit 303fd3e1c771077e32e96e5788817f025f0067e2 ]

    The signed long type used for printing the number of bytes processed in
    tcrypt benchmarks limits the range to -/+ 2 GiB, which is not sufficient
    to cover the performance of common accelerated ciphers such as AES-NI
    when benchmarked with sec=1. So switch to u64 instead.

    While at it, fix up a missing printk->pr_cont conversion in the AEAD
    benchmark.

    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    crypto/tcrypt.c | 20 ++++++++++----------
    1 file changed, 10 insertions(+), 10 deletions(-)

    diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
    index 83ad0b1fab30a..0cece1f883ebe 100644
    --- a/crypto/tcrypt.c
    +++ b/crypto/tcrypt.c
    @@ -198,8 +198,8 @@ static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc,
    goto out;
    }

    - pr_cont("%d operations in %d seconds (%ld bytes)\n",
    - bcount * num_mb, secs, (long)bcount * blen * num_mb);
    + pr_cont("%d operations in %d seconds (%llu bytes)\n",
    + bcount * num_mb, secs, (u64)bcount * blen * num_mb);

    out:
    kfree(rc);
    @@ -468,8 +468,8 @@ static int test_aead_jiffies(struct aead_request *req, int enc,
    return ret;
    }

    - printk("%d operations in %d seconds (%ld bytes)\n",
    - bcount, secs, (long)bcount * blen);
    + pr_cont("%d operations in %d seconds (%llu bytes)\n",
    + bcount, secs, (u64)bcount * blen);
    return 0;
    }

    @@ -759,8 +759,8 @@ static int test_mb_ahash_jiffies(struct test_mb_ahash_data *data, int blen,
    goto out;
    }

    - pr_cont("%d operations in %d seconds (%ld bytes)\n",
    - bcount * num_mb, secs, (long)bcount * blen * num_mb);
    + pr_cont("%d operations in %d seconds (%llu bytes)\n",
    + bcount * num_mb, secs, (u64)bcount * blen * num_mb);

    out:
    kfree(rc);
    @@ -1196,8 +1196,8 @@ static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc,
    goto out;
    }

    - pr_cont("%d operations in %d seconds (%ld bytes)\n",
    - bcount * num_mb, secs, (long)bcount * blen * num_mb);
    + pr_cont("%d operations in %d seconds (%llu bytes)\n",
    + bcount * num_mb, secs, (u64)bcount * blen * num_mb);

    out:
    kfree(rc);
    @@ -1434,8 +1434,8 @@ static int test_acipher_jiffies(struct skcipher_request *req, int enc,
    return ret;
    }

    - pr_cont("%d operations in %d seconds (%ld bytes)\n",
    - bcount, secs, (long)bcount * blen);
    + pr_cont("%d operations in %d seconds (%llu bytes)\n",
    + bcount, secs, (u64)bcount * blen);
    return 0;
    }

    --
    2.27.0
    \
     
     \ /
      Last update: 2021-02-24 15:11    [W:4.980 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site