From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C59953DD524; Mon, 30 Mar 2026 17:54:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774893249; cv=none; b=anvTeLEuA6Fg6haseC9W4d8yOMZsCG4nziVVX2Jrsd07lee9eclTG5exXCAtoIjiwyVLUz33OMleu1712t9O0V9957Uj/Beod96fdedp6y+3ZujEt+bqO3rQsvOOSdfN5Xhfeje+pvIahKhpOGiZMPHnJKbQjAvTCCIScG9ZOpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774893249; c=relaxed/simple; bh=H3IgmI8SPQqZwZqBlE4k/HBTvNhjHHrneHdkjCbtS0g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lSECkWNqSjT8TGNl2eXZgAnwC8xypYlj/6e+c+7f7XsO7mwVDlT+H8yeZbo30yuwL2sqnLhQtGewFlxrh8cMO9hJswxwTM0t6s8i44O+sSW239yhF5mmYMHn+4+ZqCSsS7Nl7A1xtMXH4tM87vzJz2ywcaGD79lzDdYJoOjWbRc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BRW69b8x; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BRW69b8x" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5EDBC4CEF7; Mon, 30 Mar 2026 17:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774893249; bh=H3IgmI8SPQqZwZqBlE4k/HBTvNhjHHrneHdkjCbtS0g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BRW69b8xDpsonfZwvopUmO/koZ1TBhIo/k+vhWDLJnkT+pl8EOGPuG6FWQ3sy5OgY I+EXY9Z9SH7ZcC2PQf0WphgN1lLs6n7hpiAIMaoYOGd3c5HcKXw5au//oxMQJHT6eR yvM0cRT7/CbHNfL6IbmC7KYHlh755orPxoKSlB/FsdEQUMCu9yMuRA9ohrjA1Vqa+q dGkEkLhldycHrejUbuF+v9uFWUibQKwjXxIISZwD9Gwk2PlynnhqpsnaLMPvG1pzbf rkJL3lwJ6+Z1ZKFbSBcrp8libFkkqkmCz3UWY/LX5kdwn/cy9a5lNfjIy1/LevmEft OCI8l1aIt2xlg== Date: Mon, 30 Mar 2026 12:54:05 -0500 From: Bjorn Andersson To: Thorsten Blum Cc: Thara Gopinath , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crypto: qce - simplify qce_xts_swapiv() Message-ID: References: <20260330173923.479407-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260330173923.479407-3-thorsten.blum@linux.dev> On Mon, Mar 30, 2026 at 07:39:25PM +0200, Thorsten Blum wrote: > Declare 'swap' as zero-initialized and use a single index variable to > simplify the byte-swapping loop in qce_xts_swapiv(). Add a comment for > clarity. > > Signed-off-by: Thorsten Blum Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/crypto/qce/common.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/crypto/qce/common.c b/drivers/crypto/qce/common.c > index 04253a8d3340..54a78a57f630 100644 > --- a/drivers/crypto/qce/common.c > +++ b/drivers/crypto/qce/common.c > @@ -280,17 +280,17 @@ static u32 qce_encr_cfg(unsigned long flags, u32 aes_key_size) > #ifdef CONFIG_CRYPTO_DEV_QCE_SKCIPHER > static void qce_xts_swapiv(__be32 *dst, const u8 *src, unsigned int ivsize) > { > - u8 swap[QCE_AES_IV_LENGTH]; > - u32 i, j; > + u8 swap[QCE_AES_IV_LENGTH] = {0}; > + unsigned int i, offset; > > if (ivsize > QCE_AES_IV_LENGTH) > return; > > - memset(swap, 0, QCE_AES_IV_LENGTH); > + offset = QCE_AES_IV_LENGTH - ivsize; > > - for (i = (QCE_AES_IV_LENGTH - ivsize), j = ivsize - 1; > - i < QCE_AES_IV_LENGTH; i++, j--) > - swap[i] = src[j]; > + /* Reverse and right-align IV bytes. */ > + for (i = 0; i < ivsize; i++) > + swap[offset + i] = src[ivsize - 1 - i]; > > qce_cpu_to_be32p_array(dst, swap, QCE_AES_IV_LENGTH); > } >