Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1977163pxb; Fri, 5 Mar 2021 04:36:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLIfJY1viT8VfS5OkOOzRsfM0es2RGc2KIjsKua2SifoF8MI5r1H/OXM7QmYpEhBUG1Lsb X-Received: by 2002:aa7:cc94:: with SMTP id p20mr8950411edt.353.1614947790800; Fri, 05 Mar 2021 04:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947790; cv=none; d=google.com; s=arc-20160816; b=U8cA20tYPM8mdfm4cRBDcMP1B9FMGra63BDTDVzHp5uBS18W+kU7SUhLMgob20IUJp IolHhAtIUNhDWNSNxLAjZZPN0+MAvrv/ophER374Bi7jfGewK3nglgjFVLTq/OhPal3u DNVapQeET/L1wduv8HLPcs5VRZJxiTvXWmyDk1jkncDu3puySvEZf5AkNFwk2Oj+khEn fIsjoGmDq6are66Qn2oItpIraQnc60CuxQWH8RBkw9dHlP6QvaEQU4GBgM47h0EFRK04 ZN4JwPdsB7DM+O8X6UmDTN1GBloWJz70xdQpe/9kfPLylk6hx0bQA5x/x/zoZp+c1d2f SUyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QsTia/iuMDC8uMKmXBWEj6M9z4zBihPP9R9RZOFwaho=; b=dHfyabTZukeWV2CN24q0nBEqVe6XuqU2OCGEvHhsj50vv9FHrIz8wpLFH0NbU2nrXq i1Jcz89NH8R9RqKn2j2fDBMfV5PmmeJQKGDUrifi0oisNsTxRB+e9b0pknDmdLpwazSC FHioRf32ZUFqgYlbpWBJQ0wflSV71CoH7tXFyPWMJw1x5WwXUizvCb/fSpjFOsmhtVuf JxLiN0CAWJef7zMERFo5dPD6VPhK9gxZbZj/sdQ4dfIg6WmYRBaqyed/8PfT9NBq3ZBF Fhqu7iRKam+1HGPspoHu++Yb3oeA0hSR/r4f//eCdE40bJL8oJWSYqQ0JW4Loj4OL+P/ Fs6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OOaUBZfQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ci15si1283174ejc.261.2021.03.05.04.36.07; Fri, 05 Mar 2021 04:36:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OOaUBZfQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232692AbhCEMfL (ORCPT + 99 others); Fri, 5 Mar 2021 07:35:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:46310 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232307AbhCEMed (ORCPT ); Fri, 5 Mar 2021 07:34:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E09E065004; Fri, 5 Mar 2021 12:34:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947672; bh=Scuye+uoxLKv2DqRj/lc/fzbmMBI6/dPqc5wKKBwEII=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OOaUBZfQ1kx6PZGRu2zw4vwhbQatrOrP/4V94zr5LDABmsQDFl+m6zECge6LQbDPx Z6vLH5+qWyMzAJASUf7Pc9Dp3UQVJPPVV0jSZ0PTmMxu2WA6OJfxicCJdoGeui8QGN Bw5vaat3DiBL3e5MPeM0EofT4ixYBtwxwsSWZKx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 42/72] crypto: tcrypt - avoid signed overflow in byte count Date: Fri, 5 Mar 2021 13:21:44 +0100 Message-Id: <20210305120859.404856531@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ard Biesheuvel [ 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 Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/tcrypt.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 83ad0b1fab30..0cece1f883eb 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.30.1