From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFC5CC10F13 for ; Mon, 8 Apr 2019 22:09:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 767F420880 for ; Mon, 8 Apr 2019 22:09:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726730AbfDHWJ3 (ORCPT ); Mon, 8 Apr 2019 18:09:29 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:39375 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726352AbfDHWJ2 (ORCPT ); Mon, 8 Apr 2019 18:09:28 -0400 Received: by mail-wr1-f67.google.com with SMTP id j9so18237771wrn.6 for ; Mon, 08 Apr 2019 15:09:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9HzFqDc9NJaJB8wgaUl1nLAIjLvZboM2e8uHtcRyOYU=; b=lS8SUB3epYdrhtZtoj6opW95dZm+PRhwRvIeU4FalcovmFrFkmXhLK5ynRIaQ51S7T H8oC2mvlqi6Pzt7q+k8nKWPqfPY7DwXhGYR/1htSMG7KjrP//ER1UjqGKFD6IvrOmh+A MVG+ID3vWHD6fDuGxlSfYO6UfWD3n2wM8P/KILtra2+M1nEEo0UvLRln7HF28ENnAdsy Ht7kZNCJwBDm7KO7w0hmx11aIKnMNRkYdEzBM4ATXzUpQso1KLC+B6uGtpM57ZeOCf+e n69Imkqz4XhswwKV9jXRTHq+mob47n/posSIdDpr8PVNVn4X+UQtqkL9/3BTkF5sJvYy bamw== X-Gm-Message-State: APjAAAVKZsjIXMS/v/JVezeKcwZxQ5rulIiB3smlsGxqGplIRUTsyZfc bza1SQMpKdUNvJLiLEjuOoeeWA== X-Google-Smtp-Source: APXvYqxgqws8BQaY3D7xyjEiA3Ix2Z/5KgaKz9tnhg+TsdFN7YJWTwQSAbMJyqUMYpmjvqe7KfxHMg== X-Received: by 2002:adf:f68d:: with SMTP id v13mr19864821wrp.6.1554761367020; Mon, 08 Apr 2019 15:09:27 -0700 (PDT) Received: from raver.teknoraver.net (net-93-70-69-135.cust.vodafonedsl.it. [93.70.69.135]) by smtp.gmail.com with ESMTPSA id y9sm53645012wrn.18.2019.04.08.15.09.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Apr 2019 15:09:26 -0700 (PDT) From: Matteo Croce To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Luis Chamberlain , Kees Cook , Alexey Dobriyan Subject: [PATCH 0/2] sysctl: share commonly used constants Date: Tue, 9 Apr 2019 00:09:23 +0200 Message-Id: <20190408220925.13077-1-mcroce@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org In the sysctl code there are a lot of duplicate constants used to validate the user input, which could be put in a shared place. Some of them are not even constant, fix this with the following patches. The first one declares the shared constants, the second one makes use of them for the kernel/ sysctls. If merged, I will send separate patches for the other susystems. Matteo Croce (2): proc/sysctl: add shared variables for range check kernel: use sysctl shared variables for range check fs/proc/proc_sysctl.c | 5 ++ include/linux/sysctl.h | 4 + kernel/pid_namespace.c | 3 +- kernel/sysctl.c | 193 ++++++++++++++++++++--------------------- kernel/ucount.c | 6 +- 5 files changed, 107 insertions(+), 104 deletions(-) -- 2.21.0