Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761942AbcLTGut (ORCPT ); Tue, 20 Dec 2016 01:50:49 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:58746 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752772AbcLTGus (ORCPT ); Tue, 20 Dec 2016 01:50:48 -0500 Date: Tue, 20 Dec 2016 06:50:13 +0000 From: Al Viro To: Scott Bauer Cc: linux-nvme@lists.infradead.org, Rafael.Antognolli@intel.com, axboe@fb.com, keith.busch@intel.com, jonathan.derrick@intel.com, hch@infradead.org, linux-kernel@vger.kernel.org, sagi@grimberg.me Subject: Re: [PATCH v3 2/5] lib: Add Sed-opal library Message-ID: <20161220065013.GC1555@ZenIV.linux.org.uk> References: <1482176149-2257-1-git-send-email-scott.bauer@intel.com> <1482176149-2257-3-git-send-email-scott.bauer@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1482176149-2257-3-git-send-email-scott.bauer@intel.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 916 Lines: 25 On Mon, Dec 19, 2016 at 12:35:46PM -0700, Scott Bauer wrote: > +int fdev_sed_ioctl(struct file *filep, unsigned int cmd, > + unsigned long arg) > +{ > + struct sed_key key; > + struct sed_context *sed_ctx; > + > + if (!capable(CAP_SYS_ADMIN)) > + return -EACCES; > + > + if (!filep->f_sedctx || !filep->f_sedctx->ops || !filep->f_sedctx->dev) > + return -ENODEV; > + > + sed_ctx = filep->f_sedctx; First of all, that's a bisect hazard. What's more, looking through the rest of patchset, WTF does it * need to be called that early in ioctl(2) handling, instead of having ->ioctl() instance for that sucker calling it? * _not_ get your ->f_sedctx as an explicit argument, passed by the caller in ->ioctl(), seeing that it's possible to calculate by file->private_data? * store that thing in struct file itself, bloating it for everything all for the sake of few drivers that might want to use that helper?