Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979830pxb; Fri, 5 Mar 2021 04:40:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/VuRzxd6QsCJVBCvpSIdeIt3puz/XrkCpVJbMe9/jEruMM7n6tkxu9f3n7VqKA5mGqPNQ X-Received: by 2002:a17:906:8904:: with SMTP id fr4mr2130654ejc.136.1614948028717; Fri, 05 Mar 2021 04:40:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614948028; cv=none; d=google.com; s=arc-20160816; b=znabQR9+H1JkzYRPsEaYL7ylkhTsVoeqvycoPqOUwRK5XmCJHXa5czw+vFmYqGwWg2 Hc/EfygZh56C+nT/q1bi5kbqf4O+9IGu6VTUMYsXgS/chDTrHvq7r6BAqudVZi0FiEwV BtB3wJ59M4GLE984naFqMvCl2tFNb21JceKktmdDv0bkJRH/+97xKHW4205ryI7xya1o LiTfp17SmRhzS5D+njwZOplGp+VrpPYIlFPEz1u/o/7LaZQ1DpSkh+gpJ5HQrhnFx1Hn IvyYJPtTYSwT1UlQlE/f/TePTFhl1IOof0tFcFG88atRS35XOVWg9CWuWNivN2R5LEv1 wZ1w== 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=J+fm+j4fOYjE0BTuxx9kO9QHiBHOq1XShFyAfjh0z7c=; b=E2gHmCqezPXLUEakw42lYc1gIr/+1tIj6upJLU6pPH3mtp7z72gsWe+rvBxcXYJkWu AjZd4oX0k8E4Ja212VdHjtgXEWAVjssK2SYCjkAqOw4Jt1TGYo+UQdBKPlsV9UYamiNV FaXqnJS0Ge9Kwlgvwa8V5ehxKlp0aCKBCmMRUMliLYkESIcySv5Ne5wF8zDqxQRKkXzJ 9NCIbXX242ajVB5gW4bSd/BaxbHH6+crYrZM/0ywwks/sokLbhCmFGBCqEFkj0yGnaWp U1SA2XL8hOBdN65sGd7d+n5vODAJP2xgMUg3x5uh3h0C2Uq9FZNFmF7m6L8d9ahD6jOQ vvPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SYytswZO; 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 t15si1248517ejj.506.2021.03.05.04.40.05; Fri, 05 Mar 2021 04:40:28 -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=SYytswZO; 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 S233175AbhCEMjJ (ORCPT + 99 others); Fri, 5 Mar 2021 07:39:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:52080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233035AbhCEMi1 (ORCPT ); Fri, 5 Mar 2021 07:38:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E073A6501E; Fri, 5 Mar 2021 12:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947907; bh=LnCYH0ucP9V04qC80BtfOoEd8k9sEqLeitH81aqb1z8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SYytswZOx7YMsgRzN+n9Oi6jnAjtYuIyaSSYocx46fnn73SWdM9+r4b4PiBRnhQQW Yotjnpe2PtFi1VwDV9tPBtOKLq59AOy5whlADSF2owBizXdIACqHVVnytSSSo8Y8MV ghnmcV0JFexMBJJCnTz/d5trXYz2VOj78gSH+r+g= 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 4.19 31/52] crypto: tcrypt - avoid signed overflow in byte count Date: Fri, 5 Mar 2021 13:22:02 +0100 Message-Id: <20210305120855.193376479@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120853.659441428@linuxfoundation.org> References: <20210305120853.659441428@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 d332988eb8de..bf797c613ba2 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -202,8 +202,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); @@ -472,8 +472,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; } @@ -763,8 +763,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); @@ -1200,8 +1200,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); @@ -1438,8 +1438,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