Received: by 10.223.185.116 with SMTP id b49csp5949079wrg; Wed, 7 Mar 2018 22:27:03 -0800 (PST) X-Google-Smtp-Source: AG47ELtJPoDnX+6HJrnit2FhZLF3baPcZ6GGEPeE0urY7Ct8goqntbwTHZ8+qfsJiuHmBTPJvGSg X-Received: by 10.167.130.193 with SMTP id f1mr24878332pfn.241.1520490423547; Wed, 07 Mar 2018 22:27:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520490423; cv=none; d=google.com; s=arc-20160816; b=U2bySCVXUOc/CMG7u2cv8OefQzpp1809AZ/Ec/IvoD9lM41wUGC+8YsSgg2/JqBcZJ +4dQwdFgBlQbTstObJNiuOy318HxtWJcLRzdjmboJDq15Px+JkBNNaXSeUQThtXDw/j1 GnfQJYmBzKBXeYeQoR7aX6tAXn8UmlDp/zhQzHGow7Gg36G4rPqb+bXuXAyHic1e8jxe iBW91HjtkD6fMxXihgeCiFaqqLTPjgiu/7BT3PAGfELWv2a+2EVsA5lEMnU6ZFMpheUr 3jjXkl78dMzrwPebebWTXnoSYY7CuuESLbroZlALrHbnJWHSKJoDerelCar7tqkLWJT0 UOYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=PjJ3Zh+IyVpYSpCqcL5wZHfJdZvzqGvNuIRiZAdJ78I=; b=azwWmFteYb6BZZjHtBM1xLjkII9jDO/eQT9MxGdOvzH2gPaTW5umrTWh4hxMYFZRFm 0vTZHWVRLWbzhIgP+3TICmb6pBnIdlkB3MrLE2PDr9aSqURI7rGPhNh69Jl1AAyIhNSU oEYp6MO8PYJJljesHTpq8HXKRol4BCi9Yigfnd2NtyaKyh1D2ajLlKFFFfDTjTkRSKGI F/LPuACtynO7xklwDf60bdPM9a6/iE00LNUG4FOSJ+Gv3CZpV8zqzGLV7iuFbN6gqEGL 37rVUkqSMqyx64NO5cKGWR0nKBd4iGbwIRV15dqU4iGMvDw2yEP6nuVRV3fq4p1qRv86 RE0Q== 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 23si9487644pfy.85.2018.03.07.22.26.49; Wed, 07 Mar 2018 22:27:03 -0800 (PST) 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 S965867AbeCHGYy (ORCPT + 99 others); Thu, 8 Mar 2018 01:24:54 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:31220 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964800AbeCHGYt (ORCPT ); Thu, 8 Mar 2018 01:24:49 -0500 X-IronPort-AV: E=Sophos;i="5.47,439,1515452400"; d="scan'208";a="257421091" Received: from abo-3-110-68.mrs.modulonet.fr (HELO [192.168.0.15]) ([85.68.110.3]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2018 07:24:47 +0100 Date: Thu, 8 Mar 2018 07:24:47 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Matthew Wilcox cc: Kees Cook , Andrew Morton , Matthew Wilcox , Linux-MM , LKML , Kernel Hardening , cocci@systeme.lip6.fr, Himanshu Jha Subject: Re: [PATCH 2/2] mm: Add kvmalloc_ab_c and kvzalloc_struct In-Reply-To: <20180308025812.GA9082@bombadil.infradead.org> Message-ID: References: <20180214182618.14627-1-willy@infradead.org> <20180214182618.14627-3-willy@infradead.org> <20180308025812.GA9082@bombadil.infradead.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 7 Mar 2018, Matthew Wilcox wrote: > On Wed, Mar 07, 2018 at 10:18:21PM +0100, Julia Lawall wrote: > > > Otherwise, yes, please. We could build a coccinelle rule for > > > additional replacements... > > > > A potential semantic patch and the changes it generates are attached > > below. Himanshu Jha helped with its development. Working on this > > uncovered one bug, where the allocated array is too large, because the > > size provided for it was a structure size, but actually only pointers to > > that structure were to be stored in it. > > This is cool! Thanks for doing the coccinelle patch! Diffstat: > > 50 files changed, 81 insertions(+), 124 deletions(-) > > I find that pretty compelling. I'll repost the kvmalloc_struct patch > imminently. Thanks. So it's OK to replace kmalloc and kzalloc, even though they didn't previously consider vmalloc and even though kmalloc doesn't zero? There are a few other cases that use GFP_NOFS and GFP_NOWAIT, but I didn't transform those because the comment says that the flags should be GFP_KERNEL based. Should those be transformed too? julia