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: 13084162 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AC9BC4332F for ; Fri, 30 Dec 2022 07:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zuvidzXNxmihllt6r6VO2TKS2TBvpkdAGOMHqxBhFzY=; b=fnQ04c680kQ5zf 3Smsyi8fZMPh7xorIWMa3FkGQwPeytbII/+KA3dZBgBtfeIBpOJ2eV934tXIdf/6uZfroLQck9f3o /qmdpfjyBnKKmqYbBtpgoAmPGt/o+IEyCIGskNAxoSMr6LrDQUEpgpY+S+QkIVIqBDVDSfUyVUqlc KBMAeLjAsEumusaMnyW+iGr6dRAV4mgqwfit38mZAMvG/iAHtYt80pd8EDln6pULh6Bhs2bf1o1Ey KUiYaXRB0UgqVRLW3dl3Fczqp9t/P3r+qb7xwNb3WXMAy9RaxzVXg+/+xoGm8ucjWP6Mf3bVVbXLB HKpIBTVR6eC4jAzIx3BA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pB9s0-006uSX-3R; Fri, 30 Dec 2022 07:32:00 +0000 Received: from helcar.hmeau.com ([216.24.177.18] helo=formenos.hmeau.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pB9rx-006uR1-6I for linux-arm-kernel@lists.infradead.org; Fri, 30 Dec 2022 07:31:58 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221229_233157_236918_24079A08 X-CRM114-Status: GOOD ( 10.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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) {