Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11656778rwl; Tue, 3 Jan 2023 02:46:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXtiv5w3PC3LVZCk1o0iy7AcEmfjySVcACidRHu6X/B7LmD1CoRfP0ylKMqw1DyMiKivhVzE X-Received: by 2002:a17:906:a842:b0:816:ef2a:631a with SMTP id dx2-20020a170906a84200b00816ef2a631amr37719348ejb.31.1672742785467; Tue, 03 Jan 2023 02:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672742785; cv=none; d=google.com; s=arc-20160816; b=UpVHLgEHB8o/L4j3FHvKoO1+FL85Ao0DUcGywBCjNGjm+CkDkhxBXdTwhoQocC6oxm a59lqBsf59/mx36pGS+b61sbhgRjQv4AGdgJhBVl8/lVJuk3LlFJ+wqn4ZxtKMOkllr4 K9byY768U3Tr2VxSgKN/J9aHVpcudgKHVvRaYFGAO10LkkP4+6W1l6Jm8Letgl3YJbdn VwCMH6apaQ5Cn3oznYjRjErOyIqzypB9N1rU4eiuSrze3lErxWeLF2VoJQ1Z/54vF8Hu hyGppaWJibxFZIGC73YA88fQMuL15Jer6WHFaGuHgi9OIeixcIK7mrZi9awne+ihfYvN mPzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mQ+kH7Y1jP8FPnV3r6fvzT20qbbg9pYdOaXBVU8Mh1s=; b=p6YWijWysExiyeAdsTs8KLKvmdwqhHYFIj3L12h7cpiBarMlxtmMsIKj6Q3tfckSOw ph9Z+ChxnYnTG6IzCUjN97tGY4Q+FTU9X3pdBbv7Cx0oa4pwEYs4MX+yY8g/SDNn8US9 io0w387zC3RLG2cIC+e8q8SGySIs3H/qOeHIAi4JxL7eSpQx1Stz+uxXHT+ey3GSeMks iGYDWaeY9dWMcxznHOnxHQJpswdxlbTRcJzKAWUxUGE3yS8lSr/NqjQxI6b1v0y/dFPl ivSRaUwI2BgLcAa5myarhuGsc8PbdRc2ldep398Su9Az/XzGGsQHfzsunk1jYXhlWEpx ZuYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=VfiIGMI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j27-20020a170906279b00b007a8beb3aa4csi21081022ejc.872.2023.01.03.02.46.10; Tue, 03 Jan 2023 02:46:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=VfiIGMI2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233145AbjACKT1 (ORCPT + 61 others); Tue, 3 Jan 2023 05:19:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232898AbjACKTZ (ORCPT ); Tue, 3 Jan 2023 05:19:25 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F50DE9D for ; Tue, 3 Jan 2023 02:19:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mQ+kH7Y1jP8FPnV3r6fvzT20qbbg9pYdOaXBVU8Mh1s=; b=VfiIGMI2Jwicl5gjt8FuQRhlgB FtZPIMyWuAC4dgXlPh3TkJuEvvN+V0RWGejKvr4P5AGwseO7pDjNmN5yiVfQJmZO09UEPWc6ZtPJ+ ErgjrC0kT2jtz/DG0Vks/zZnVUH861EWUJBfJdRstwFZr+k0ygSCHgv/YuH6/DUIKfQlz7nI2OIUn W8XAdWtdq+xUtMMDjYd+hCDMaEkA0vGy1OaFYiqzZAqXV9RTTmf9itr6fU8YLfgaRs9AMrAObCGEp AiJUNANy6036vD/1GpQsBMaNjCblNsUReY/aU4OOHe0BBRA+lptViivo2TdYUITBzxOQ3iP8F6OLZ 2b6s46eA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35912) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pCeOA-0005Cm-J8; Tue, 03 Jan 2023 10:19:22 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pCeO8-0001yu-W1; Tue, 03 Jan 2023 10:19:21 +0000 Date: Tue, 3 Jan 2023 10:19:20 +0000 From: "Russell King (Oracle)" To: Deepak R Varma Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Praveen Kumar , Saurabh Singh Sengar , Julia Lawall Subject: Re: [PATCH v2] ARM/dma-mapping: use kvcalloc for fallback memory allocation need Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 28, 2022 at 03:49:44PM +0530, Deepak R Varma wrote: > On Tue, Dec 20, 2022 at 07:46:32PM +0530, Deepak R Varma wrote: > > Current conditional determination of whether to use kzalloc or vzalloc > > has known issues such as "indefinite retry" when less than PAGE_SIZE > > memory is needed, but is unavailable. This LWN article [1] describes > > these issues in greater detail. Use helper function kvcalloc() instead > > which is more efficient in terms of performance and security. > > > > [1] https://lwn.net/Articles/711653/ > > > > This patch proposal is based on following Coccinelle warning using the > > kvmalloc.cocci semantic patch. > > arch/arm/mm/dma-mapping.c:858:28-29: WARNING opportunity for kvmalloc > > > > The semantic patch suggests using kvzalloc() helper function, however, > > this patch proposes to use kvcalloc instead. kvcalloc() helper function > > uses 2-factor argument form which is better from a security perspective > > as described in the following KSPP project commit. > > > > Commit 4e3fd7217105 ("wireguard: ratelimiter: use kvcalloc() instead of kvzalloc()") > > > > Signed-off-by: Deepak R Varma > > Hello, > May I please request a review and feedback on this patch proposal? The DMA API on ARM has been maintained by others recently, so it's no longer up to me. Please include Christoph Hellwig when sending changes for this. Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!