From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754122AbcI2L1I (ORCPT ); Thu, 29 Sep 2016 07:27:08 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:16906 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753177AbcI2L1B (ORCPT ); Thu, 29 Sep 2016 07:27:01 -0400 Subject: Re: [PATCH v2 2/8] pipe: move limit checking logic into pipe_set_size() To: "Michael Kerrisk (man-pages)" , Andrew Morton References: <3701b2c5-2c52-2c3e-226d-29b9deb29b50@gmail.com> Cc: Willy Tarreau , socketpair@gmail.com, Tetsuo Handa , Jens Axboe , Al Viro , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Joe Perches From: Vegard Nossum Message-ID: <1e7bdfb3-0772-c152-8da1-3d22b56682b3@oracle.com> Date: Thu, 29 Sep 2016 13:26:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <3701b2c5-2c52-2c3e-226d-29b9deb29b50@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/29/2016 02:21 AM, Michael Kerrisk (man-pages) wrote: > This is a preparatory patch for following work. Move the F_SETPIPE_SZ > limit-checking logic from pipe_fcntl() into pipe_set_size(). This > simplifies the code a little, and allows for reworking required in > a later patch that fixes the limit checking in pipe_set_size() > + if ((too_many_pipe_buffers_hard(pipe->user) || > + too_many_pipe_buffers_soft(pipe->user)) && > + !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN)) > + return -EPERM; Some might say the indentation is off here. Not sure why checkpatch didn't care. Otherwise looks fine to me. Vegard