Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp417318pxb; Wed, 24 Feb 2021 05:51:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSJltdwldyP1sPCTFFUd0RYHKHAPc9bucieHAKpa62EKRxDt9wxdLvI28YEVCjkiL3HDUP X-Received: by 2002:a17:907:2716:: with SMTP id w22mr20894497ejk.404.1614174711297; Wed, 24 Feb 2021 05:51:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614174711; cv=none; d=google.com; s=arc-20160816; b=W1uep2gdjmvJI9KfD4KYF3eFuntTHBT0ignJF2Y9Nc8KKNUf1Ch83sjdqqWSl2Via7 HDO1ujqfIznj8n3FIqlTnJclxJCEYl5zP7alu504g2KTJiCGyzzDwnIuOPhXkW7csbeI v6oTy/DYSbckC7ivqBkIRb+6Dcv/CFinBc9hTpMxwqHQk1HiFxW/qzqZlua7cEzw9tjr YAiB6NOpgSTEbgr79V69XG94Ey6MVG2GQAJW2ZJk8rOUykGsEoOOBMr7llo9gMRlaaLQ 2BEOHJUQP5zjc81Nl29Cl3Gq7L07sFCXUIyoaLTNeapdNyww3a64S3fEmR5Sr7aJz25/ eyvQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NceWNW6TkVturpmXFdLFWZDemO4piLsELE897QXHfEU=; b=EDSdfei2lGEibkXHCXOVizmTk4/5g9SnwFcgegU8uppnbQU3Gz/SNb5E18EUIWgPhQ 6FnVej33jFX9BMnTT5SnkKheGXzv0PCegoyOumL+wE7/UNzLtm4wIwHK6pMlOhQ1Tptt ScDxIlLnZYe6tpHZ939i1a30yZrIpi0vqPHncURPbJiIWcP978iNf1V4nHYCcaWtsGMS RsDaoLbUjkF5U9NsRks/wzFuEP1cfMxdqA9x9oc/M3ENwEgYCMStjjKyjEGsRjji+XEB DTT8PnLHByqQMU0jRZ1YQ60UAATk6A59lzLjTMTmJkfq/XO5/8/PJQchRNoPQAjeOraj Z+pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KOZIBCsQ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g11si1405895ejt.597.2021.02.24.05.51.04; Wed, 24 Feb 2021 05:51:51 -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=@kernel.org header.s=k20201202 header.b=KOZIBCsQ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234907AbhBXNnT (ORCPT + 99 others); Wed, 24 Feb 2021 08:43:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:58438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235712AbhBXNFC (ORCPT ); Wed, 24 Feb 2021 08:05:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B088B64F7B; Wed, 24 Feb 2021 12:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614171242; bh=CbtLJBjPW04CHToB/xRnlOVVoQA1aptjneT2df6DPJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOZIBCsQsHtsPSTOPvKnCYVGLrEkPkXv3aBRysRKmJ0Alh8gbqPSMAOfk2/VnYZOS h2VN38ngfaBK5W2okWN8gfConNsKv3AusKgBtnneTz18Lra3emxeONrssYJNbuk0mI FkAkQcpGhQI0tKs4gV8k53ov7Uw0M64nv834UCwXb4ZZPf4se4sA1q7rLueeCKUokH WyAUD7FBBbdoUdiZ8BZfb8z4+RubSY8TsM8wIGek4TYURiO9QT6gS+CIoPdXpIydRI QEfDLjAd2dXnmbwdtMXC9fiUEGL4Gy29f3NVsNWeAI177SX3fpsYMVFN6XkfGypGoE w94s98LsZ0VGw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ard Biesheuvel , Herbert Xu , Sasha Levin , linux-crypto@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 16/40] crypto: tcrypt - avoid signed overflow in byte count Date: Wed, 24 Feb 2021 07:53:16 -0500 Message-Id: <20210224125340.483162-16-sashal@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210224125340.483162-1-sashal@kernel.org> References: <20210224125340.483162-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 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