From owner-svn-src-all@FreeBSD.ORG Wed Jan 21 18:32:54 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2A3061C6; Wed, 21 Jan 2015 18:32:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16BE1A95; Wed, 21 Jan 2015 18:32:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0LIWrum055770; Wed, 21 Jan 2015 18:32:53 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0LIWrvJ055769; Wed, 21 Jan 2015 18:32:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201501211832.t0LIWrvJ055769@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 21 Jan 2015 18:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r277496 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Jan 2015 18:32:54 -0000 Author: mjg Date: Wed Jan 21 18:32:53 2015 New Revision: 277496 URL: https://svnweb.freebsd.org/changeset/base/277496 Log: filedesc: avoid spurious copying of capabilities in fget_unlocked We obtain a stable copy and store it in local 'fde' variable. Storing another copy (based on aforementioned variable) does not serve any purpose. No functional changes. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jan 21 18:05:42 2015 (r277495) +++ head/sys/kern/kern_descrip.c Wed Jan 21 18:32:53 2015 (r277496) @@ -2337,7 +2337,7 @@ fget_unlocked(struct filedesc *fdp, int u_int count; #ifdef CAPABILITIES seq_t seq; - cap_rights_t haverights; + cap_rights_t *haverights; int error; #endif @@ -2367,9 +2367,9 @@ fget_unlocked(struct filedesc *fdp, int if (fp == NULL) return (EBADF); #ifdef CAPABILITIES - haverights = *cap_rights_fde(&fde); + haverights = cap_rights_fde(&fde); if (needrightsp != NULL) { - error = cap_check(&haverights, needrightsp); + error = cap_check(haverights, needrightsp); if (error != 0) return (error); if (cap_rights_is_set(needrightsp, CAP_FCNTL)) { @@ -2408,7 +2408,7 @@ fget_unlocked(struct filedesc *fdp, int *fpp = fp; if (haverightsp != NULL) { #ifdef CAPABILITIES - *haverightsp = haverights; + *haverightsp = *haverights; #else CAP_ALL(haverightsp); #endif