From patchwork Fri Dec 30 07:31:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Xu X-Patchwork-Id: 13084161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03056C4332F for ; Fri, 30 Dec 2022 07:31:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4410D8E0002; Fri, 30 Dec 2022 02:31:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F1448E0001; Fri, 30 Dec 2022 02:31:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E0098E0002; Fri, 30 Dec 2022 02:31:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 187B38E0001 for ; Fri, 30 Dec 2022 02:31:58 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DFBDE1C0DF4 for ; Fri, 30 Dec 2022 07:31:57 +0000 (UTC) X-FDA: 80298153474.12.A920718 Received: from formenos.hmeau.com (helcar.hmeau.com [216.24.177.18]) by imf21.hostedemail.com (Postfix) with ESMTP id A58051C0014 for ; Fri, 30 Dec 2022 07:31:55 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf21.hostedemail.com: domain of herbert@gondor.apana.org.au designates 216.24.177.18 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672385516; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o9xIo+TxJ70NC+yyZzbFOvMzr2zB8BFkjON4Wn1Ocgk=; b=iVV1qcTWbQNXGZGrzDAFttNyzTBskqcToRtbGzc54REvVQncq0tP0/+/KCGjzfW0wvGZcI t2nfJSaIBHKt2cwk1IC/xh4jn5FXjhRupvotQwLgc/bnarmAOQIMxdgi1LSwxd6pbYicWn 8j32Cx7EBT0ZGcV62Yzal3bdnYn9tdU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf21.hostedemail.com: domain of herbert@gondor.apana.org.au designates 216.24.177.18 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672385516; a=rsa-sha256; cv=none; b=uNjxuJ75GRock2BmMeQXd1vQ7ePitNRyre1JoM0mE1SRJoF3HFn1rGjL+9l0pjP09z5n9E u44RjMM+Kmo9r1/6mjZakNkNw1ac0IEBCs6Sn98n0S0YXrPEJbbt+IdjCGtsCAixyyq/SJ ttNT8b/Aw2uTaMojrWkSwWOUZSAmlnI= Received: from loth.rohan.me.apana.org.au ([192.168.167.2]) by formenos.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1pB9rZ-00CGJz-Vs; Fri, 30 Dec 2022 15:31:35 +0800 Received: by loth.rohan.me.apana.org.au (sSMTP sendmail emulation); Fri, 30 Dec 2022 15:31:33 +0800 Date: Fri, 30 Dec 2022 15:31:33 +0800 From: Herbert Xu To: Christoph Hellwig Cc: Catalin Marinas , Ard Biesheuvel , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" , Linux Crypto Mailing List , Christophe Leroy Subject: [PATCH] crypto: talitos - Remove GFP_DMA and add DMA alignment padding Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A58051C0014 X-Stat-Signature: az9d9haimw4ehazap94aat8q7hwrat9y X-Rspam-User: X-HE-Tag: 1672385515-153931 X-HE-Meta: U2FsdGVkX19YwACd62BcEJl4LUGEzGopLSmmC6l5Kt5cwXm4Cs6aptXVxUg5sPbZGLYSUIh8ml5l8oZRegbPhLNzBkDlxWLHx/3WtF/xy02m6lMd/boEkpjcN8erOBf5TL+nLva0D4OTnxU6mWN14w5jx2qoGJn5TmBCootwcdaqwLY1K/ETOzCc5aRcUxiYmioqTuDzrpei1qD52JfNj/yJHQ/Ql+IfCFYRd/DgXdhvwgjkc0S7keDrSpshdP7Am6nW3gnEBCLembzxYo3GJMu0QMISBTdlu/IgpZznL5zuRm1q53GsmHJRbAFwqnMLqN3/zhFQqRBY9E8r0TSH+bUcoRg2QjXZtmZ2PKPYGgypBtGV/7aN6kwpNVx4xtiU4gRpREBlGCfYBDMnFXEJCgXTXsP5N+QuE5WrM5PLkR+YLyzoOYudV38oEwSgeRa9coSBgydWkwgICOLBA8bcNNmv30Adl2tkDi1z0vYPO5FW9wD776chNNUioFD7qH7zluIUabTRnZQmFSXQva3lYehIUwyFVhjbRVvTI6LIB0R8J6f/51gy9HBfKK23JXODgI2HXh3IIFGsKoW94xFWriq8aPE7JFCsDszSoDW4/zPxhRjfI/GoqY7v6d2wHCdwbHJXWOVAR7zOMptBrZ5LONqejuw4WvKMvenQsGe+zsqhO8+xd4J4UDQ7iag0qHv7Oo2bsfeglOxLvKx4o3FIViPPOWr03lMUyllosdGQmbi2UiC6dDB/5FQTi92rMOeHDylhpUqvnRgGw6ypPnpKPxIB6PuUkcL5zfWs/JcT9R0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: GFP_DMA does not guarantee that the returned memory is aligned for DMA. It should be removed where it is superfluous. However, kmalloc may start returning DMA-unaligned memory in future so fix this by adding the alignment by hand. Signed-off-by: Herbert Xu Reviewed-by: Christoph Hellwig diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 71db6450b6aa..d62ec68e3183 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1393,7 +1393,7 @@ static struct talitos_edesc *talitos_edesc_alloc(struct device *dev, alloc_len += sizeof(struct talitos_desc); alloc_len += ivsize; - edesc = kmalloc(alloc_len, GFP_DMA | flags); + edesc = kmalloc(ALIGN(alloc_len, dma_get_cache_alignment()), flags); if (!edesc) return ERR_PTR(-ENOMEM); if (ivsize) {