Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2471300imm; Sun, 7 Oct 2018 05:01:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV60yb0tIozGPMrdb2GowQMyPXCX6y3IcXlNha6wa0cZNZYsTS7LcjOU0Jae1E3QqQyaxrpLw X-Received: by 2002:a63:5a0d:: with SMTP id o13-v6mr17274749pgb.267.1538913717012; Sun, 07 Oct 2018 05:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538913716; cv=none; d=google.com; s=arc-20160816; b=JJeem4vtb2/RtGTBvfKWzI8Ed77gzRK0WlBfsQPN07QiXtBK1mlHvaHx05Du5eq/HC 5v5cV8CpSAi4bWuEFwIySSrVFBv5b0H/C8Zwu4SebqulURbxTslg2MtR2GZlsNPd5JBN Do2mFr/312Yi1cpJyRP3xXS7vLaOJJpA78qlWghUp/ZlrIOpJ5LWe6ELSiTchlT/hNLM se8N6gruxi1xRaFwawArVQkmVBJ9NhL9tBzntq3eGnPrPt6miQ7Seh5DfuhOQv5nky6f CCmzmGaHwr+kXNFLw2dndGUA4sYt8c6//BjpZQKjaaoL56qJNzHQ1rx6U3U8gBD88G0h y2Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=f6Vz2XNbrFITRUF+eI5BGvvzAtDnwKoAnlMONzY7m08=; b=G+y/xT9Izq8h2esxjdJ+eSPdZGpgn7gz+auFQeo6dbbk0IrRdmO4Te+jgHDPwC0Mdk FhOavyv1G5bQOMb8yb6Re9HCShEhFdTTeSHvc9A7RjgtZzCWTJd8plXM3GXd/G7zu7b8 X/JCPAA2AnXBhu3/KL9yZ4bMQzwLppZLPloKk84qYXO5ekxcR9mp1w59kknAFzofXlqf or8yeS5UYJknBzB5IM+j9TzGZ/WI4L4EOKlD0mUs1/Yj4+LljQGLZ+MH54aHaJ/aQjsS 1nOAVxV+kXxF30mm+eaFRzw+o06lRNql10Dqn9PcmNoak0215Q5IiOMTOe70/ZRaaB9x f25Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1-v6si14586105plb.166.2018.10.07.05.01.19; Sun, 07 Oct 2018 05:01:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726972AbeJGTIP (ORCPT + 99 others); Sun, 7 Oct 2018 15:08:15 -0400 Received: from gravityforest ([185.233.107.85]:47904 "EHLO gravity.schupikov.de" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1726396AbeJGTIP (ORCPT ); Sun, 7 Oct 2018 15:08:15 -0400 Received: from zlid.rus.uni-stuttgart.de (s-8d3a2233.on.site.uni-stuttgart.de [141.58.34.51]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by gravity.schupikov.de (Postfix) with ESMTPSA id 58CB55D146; Sun, 7 Oct 2018 14:01:11 +0200 (CEST) From: Michael Schupikov To: Herbert Xu Cc: Michael Schupikov , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto/testmgr.c: fix sizeof() on COMP_BUF_SIZE Date: Sun, 7 Oct 2018 13:58:10 +0200 Message-Id: <20181007115810.27779-1-michael@schupikov.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After allocation, output and decomp_output both point to memory chunks of size COMP_BUF_SIZE. Then, only the first bytes are zeroed out using sizeof(COMP_BUF_SIZE) as parameter to memset(), because sizeof(COMP_BUF_SIZE) provides the size of the constant and not the size of allocated memory. Instead, the whole allocated memory is meant to be zeroed out. Use COMP_BUF_SIZE as parameter to memset() directly in order to accomplish this. Fixes: 336073840a872 ("crypto: testmgr - Allow different compression results") Signed-off-by: Michael Schupikov --- crypto/testmgr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index a1d42245082a..790aa3536631 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -1400,8 +1400,8 @@ static int test_comp(struct crypto_comp *tfm, int ilen; unsigned int dlen = COMP_BUF_SIZE; - memset(output, 0, sizeof(COMP_BUF_SIZE)); - memset(decomp_output, 0, sizeof(COMP_BUF_SIZE)); + memset(output, 0, COMP_BUF_SIZE); + memset(decomp_output, 0, COMP_BUF_SIZE); ilen = ctemplate[i].inlen; ret = crypto_comp_compress(tfm, ctemplate[i].input, @@ -1445,7 +1445,7 @@ static int test_comp(struct crypto_comp *tfm, int ilen; unsigned int dlen = COMP_BUF_SIZE; - memset(decomp_output, 0, sizeof(COMP_BUF_SIZE)); + memset(decomp_output, 0, COMP_BUF_SIZE); ilen = dtemplate[i].inlen; ret = crypto_comp_decompress(tfm, dtemplate[i].input, -- 2.19.0