Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5074276yba; Tue, 30 Apr 2019 08:44:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7hVnqpcJKY4MYceGJuj+ukmPnoANp1YmOayfZCGi9vG6S8SkBxhd5VfoQpnA+X2hFCbLt X-Received: by 2002:a63:8dc9:: with SMTP id z192mr23463944pgd.6.1556639059203; Tue, 30 Apr 2019 08:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556639059; cv=none; d=google.com; s=arc-20160816; b=FM+ULobe+a0AmlEok8dftG6b0fdbD2br4qo/Hbnj0DrcAY4aUz3tWruOk0DisOnoIx pUlx2ACj39sAxuJhXumwEodpmEBO5IHknXKAx9INbJueLG6GZE0q2WoVjIr9Uk9JiJKI 5tk6BlzVyIHHfyELxLiThB65NqeHGlnongfiDv+HljuCPRkxYwTfL51vcT3QXz0pJuMv 97wWtpqno8c+KBbzyj4/1f/0zfbFGsZOYAaVgtIvsorIaPEGlhLA6LvIfPySDUxgq1c8 m1RaFzFxjQcMOiqz0rxquH/A+XnMNatbjI+/hKDNoBKQ1+YIMqGAuCQvV/W2bHu4V72R drhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rxw3hN1YSm26ISg+LOrlcUFUk2/ynydw3TOb8ZPeF0s=; b=SwPQdgaTVxHd0IrfwBQeVCPv+ehETMQj9FGU/a5xi/OhAnhzdk2aOUY5w8DRwy3Rn7 xXpdu+HwwA+2uAMbbjuAsTZsAgbWU9SN6Svsvaxgx8p21aWMKcKz9GYcB7Tbvc+Ih9DR yfIppSLmV+DKes50ZMleTJrqajM9vXAuRgTcP8LtHM7tldkpu1jOT9em5//MmGyQE4uH myQjYsI05oKUAIALNzHbjMywHkI6jNx4lByQrj5qV1r1sTee1nGA1k5Ghtc0fRoJxooI F114n80n2M8OiASXGqcv29vJOKBBonltF8yx8fEBukfXIDfcjv43WuDf73kWaxttKQ2q 8ZCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="O/YPSKpd"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f17si38121590pgd.243.2019.04.30.08.44.01; Tue, 30 Apr 2019 08:44:19 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b="O/YPSKpd"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726056AbfD3PnB (ORCPT + 99 others); Tue, 30 Apr 2019 11:43:01 -0400 Received: from mail-vs1-f65.google.com ([209.85.217.65]:36006 "EHLO mail-vs1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfD3PnB (ORCPT ); Tue, 30 Apr 2019 11:43:01 -0400 Received: by mail-vs1-f65.google.com with SMTP id x78so5847563vsc.3 for ; Tue, 30 Apr 2019 08:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rxw3hN1YSm26ISg+LOrlcUFUk2/ynydw3TOb8ZPeF0s=; b=O/YPSKpdJNfI7U6oIOgur+JBh6lLTX26M/YLxxTMTTbCOdPzII6OA9QsPMywPziiVG zpbQJz5mB/J7NdHufCTiy3vXfHvVklhiXXTRr5MFYctmmoM/5ysemaK2nE9o2A82LpFE EkHyne5+Jcq6bx5DKtAGx12ur+JpsGrBj8JHk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rxw3hN1YSm26ISg+LOrlcUFUk2/ynydw3TOb8ZPeF0s=; b=FC3RJQjsTc16tVzXv9DEzO7Gz+ct1l0WI+b//T8OyIPTwnWmNJ6Nyh2vv+lgUhVQXl OVaJoN7bEs9oB5vzyHB3hTiKQKHgGbgbcDENaugpizFjgkwaTxixTWEjePDI0kwADT/L NALsoSYjbNtOHLdb27OXVEbqGlWpWjUXJdTqEXI/monAYNKmb1q8zo5r7vkbQlFVQw9J WaSxiLkOJU7de7rmPjYdzMzT773KlpnfnI8yYE/Jbxl+PRHolJXRj0h4rq1je8ewjiC+ TpGZu5u8fiVAlsp7xQ0xcOh4CbvizAJtcPgpOoLdXkJ0sgiU97lSC7+xjFQ5F9+Gd2pO ArPg== X-Gm-Message-State: APjAAAUyQ2+/FRE+kQEjBceigXKj91NnszCY1ScN0Z1sT9CRDj2clq58 xMpuGdp4iSHv2/S3dFE7Y5fPaGsu1R0= X-Received: by 2002:a67:a446:: with SMTP id p6mr36133665vsh.198.1556638979956; Tue, 30 Apr 2019 08:42:59 -0700 (PDT) Received: from mail-vs1-f53.google.com (mail-vs1-f53.google.com. [209.85.217.53]) by smtp.gmail.com with ESMTPSA id v124sm8640444vke.42.2019.04.30.08.42.54 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 30 Apr 2019 08:42:55 -0700 (PDT) Received: by mail-vs1-f53.google.com with SMTP id g127so8272416vsd.6 for ; Tue, 30 Apr 2019 08:42:54 -0700 (PDT) X-Received: by 2002:a67:eecb:: with SMTP id o11mr36496756vsp.66.1556638973924; Tue, 30 Apr 2019 08:42:53 -0700 (PDT) MIME-Version: 1.0 References: <20190429222613.13345-1-mcroce@redhat.com> In-Reply-To: From: Kees Cook Date: Tue, 30 Apr 2019 08:42:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4] proc/sysctl: add shared variables for range check To: Matteo Croce Cc: LKML , "linux-fsdevel@vger.kernel.org" , Andrew Morton , Matthew Wilcox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 3:47 AM Matteo Croce wrote: > > On Tue, Apr 30, 2019 at 12:26 AM Matteo Croce wrote: > > > > Add a const int array containing the most commonly used values, > > some macros to refer more easily to the correct array member, > > and use them instead of creating a local one for every object file. > > > > Ok it seems that this simply can't be done, because there are at least > two points where extra1,2 are set to a non const struct: > in ip_vs_control_net_init_sysctl() it's assigned to struct netns_ipvs, > while in mpls_dev_sysctl_register() it's assigned to a struct mpls_dev > and a struct net. Why can't these be converted to const also? I don't see the pointer changing anywhere. They're created in one place and never changed. If it's only a couple places, it seems like it'd be nice to get these fixed. -- Kees Cook