From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752161AbdECS0w (ORCPT ); Wed, 3 May 2017 14:26:52 -0400 Received: from smtprelay0009.hostedemail.com ([216.40.44.9]:43869 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751159AbdECS0n (ORCPT ); Wed, 3 May 2017 14:26:43 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:966:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3868:3870:4321:4385:5007:10004:10400:10848:11026:11232:11658:11914:12043:12296:12438:12740:12760:12895:13069:13311:13357:13439:14659:14721:21080:21433:21627:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: paste23_9171b9ea92830 X-Filterd-Recvd-Size: 1784 Message-ID: <1493835998.22125.15.camel@perches.com> Subject: Re: [PATCH 3/9] VFS: Introduce a mount context From: Joe Perches To: Jeff Layton , David Howells , viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, mszeredi@redhat.com Date: Wed, 03 May 2017 11:26:38 -0700 In-Reply-To: <1493835238.3180.7.camel@poochiereds.net> References: <149382747487.30481.15428192741961545429.stgit@warthog.procyon.org.uk> <149382749941.30481.11685229083280551867.stgit@warthog.procyon.org.uk> <1493835238.3180.7.camel@poochiereds.net> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2017-05-03 at 14:13 -0400, Jeff Layton wrote: > On Wed, 2017-05-03 at 17:04 +0100, David Howells wrote: > > Introduce a mount context concept. trivia: > > static int selinux_mount_ctx_option(struct mount_context *mc, char *opt) > > +{ [] > > + if (opts->mnt_opts) { > > + oo = kmalloc((opts->num_mnt_opts + 1) * sizeof(char *), > > + GFP_KERNEL); > > + if (!oo) > > + return -ENOMEM; > > + memcpy(oo, opts->mnt_opts, opts->num_mnt_opts * sizeof(char *)); > > + oo[opts->num_mnt_opts] = NULL; > > + old = opts->mnt_opts; > > + opts->mnt_opts = oo; > > + kfree(old); > > + } krealloc would probably be more efficient and possible readable as likely there's already padding in the original allocation. Are there no locking constraints?