From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f177.google.com ([209.85.217.177]:39626 "EHLO mail-ua0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755350AbeD3Wkb (ORCPT ); Mon, 30 Apr 2018 18:40:31 -0400 Received: by mail-ua0-f177.google.com with SMTP id g10so6449953ual.6 for ; Mon, 30 Apr 2018 15:40:31 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1524862838-8247-4-git-send-email-longman@redhat.com> References: <1524862838-8247-1-git-send-email-longman@redhat.com> <1524862838-8247-4-git-send-email-longman@redhat.com> From: Kees Cook Date: Mon, 30 Apr 2018 15:40:29 -0700 Message-ID: Subject: Re: [PATCH v6 3/8] sysctl: Warn when a clamped sysctl parameter is set out of range To: Waiman Long Cc: "Luis R. Rodriguez" , Andrew Morton , Jonathan Corbet , LKML , "linux-fsdevel@vger.kernel.org" , linux-doc@vger.kernel.org, Al Viro , Matthew Wilcox , "Eric W. Biederman" Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org List-ID: I like this series overall, thanks! No objections from me. One thing I noted, though: On Fri, Apr 27, 2018 at 2:00 PM, Waiman Long wrote: > if (param->min && *param->min > val) { > if (clamp) { > val = *param->min; > + clamped = true; > } else { > return -EINVAL; > } This appears as a common bit of logic in many places in the series. It seems like it'd make sense to make this a helper of some kind? -Kees -- Kees Cook Pixel Security