From patchwork Mon Feb 13 16:11:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Bauer X-Patchwork-Id: 9570227 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 82B1C60442 for ; Mon, 13 Feb 2017 16:21:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 749D425F31 for ; Mon, 13 Feb 2017 16:21:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6975B26E76; Mon, 13 Feb 2017 16:21:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17CE125F31 for ; Mon, 13 Feb 2017 16:21:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752088AbdBMQVf (ORCPT ); Mon, 13 Feb 2017 11:21:35 -0500 Received: from mga09.intel.com ([134.134.136.24]:20831 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752117AbdBMQUr (ORCPT ); Mon, 13 Feb 2017 11:20:47 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2017 08:20:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,156,1484035200"; d="scan'208";a="1106799025" Received: from sbauer-z170x-ud5.lm.intel.com ([10.232.112.157]) by fmsmga001.fm.intel.com with ESMTP; 13 Feb 2017 08:20:45 -0800 From: Scott Bauer To: linux-nvme@lists.infradead.org Cc: David.Laight@ACULAB.COM, arnd@arndb.de, axboe@fb.com, keith.busch@intel.com, jonathan.derrick@intel.com, hch@infradead.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Scott Bauer Subject: [PATCH V5 1/4] block: sed-opal: change ioctl to take user pointer instead of unsinged long Date: Mon, 13 Feb 2017 09:11:09 -0700 Message-Id: <1487002272-17940-2-git-send-email-scott.bauer@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487002272-17940-1-git-send-email-scott.bauer@intel.com> References: <1487002272-17940-1-git-send-email-scott.bauer@intel.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Scott Bauer --- block/sed-opal.c | 6 ++++-- drivers/nvme/host/core.c | 3 ++- include/linux/sed-opal.h | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/block/sed-opal.c b/block/sed-opal.c index bf1406e..2448d4a 100644 --- a/block/sed-opal.c +++ b/block/sed-opal.c @@ -2344,9 +2344,11 @@ bool opal_unlock_from_suspend(struct opal_dev *dev) } EXPORT_SYMBOL(opal_unlock_from_suspend); -int sed_ioctl(struct opal_dev *dev, unsigned int cmd, unsigned long ptr) +int sed_ioctl(struct opal_dev *dev, unsigned int cmd, void __user *arg) { - void __user *arg = (void __user *)ptr; + void *ioctl_ptr; + int ret = -ENOTTY; + unsigned int cmd_size = _IOC_SIZE(cmd); if (!capable(CAP_SYS_ADMIN)) return -EACCES; diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d9f4903..04c48e7 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -811,7 +811,8 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, return nvme_nvm_ioctl(ns, cmd, arg); #endif if (is_sed_ioctl(cmd)) - return sed_ioctl(&ns->ctrl->opal_dev, cmd, arg); + return sed_ioctl(&ns->ctrl->opal_dev, cmd, + (void __user *) arg); return -ENOTTY; } } diff --git a/include/linux/sed-opal.h b/include/linux/sed-opal.h index af1a85e..205d520 100644 --- a/include/linux/sed-opal.h +++ b/include/linux/sed-opal.h @@ -132,7 +132,7 @@ struct opal_dev { #ifdef CONFIG_BLK_SED_OPAL bool opal_unlock_from_suspend(struct opal_dev *dev); void init_opal_dev(struct opal_dev *opal_dev, sec_send_recv *send_recv); -int sed_ioctl(struct opal_dev *dev, unsigned int cmd, unsigned long ptr); +int sed_ioctl(struct opal_dev *dev, unsigned int cmd, void __user *ioctl_ptr); static inline bool is_sed_ioctl(unsigned int cmd) { @@ -160,7 +160,7 @@ static inline bool is_sed_ioctl(unsigned int cmd) } static inline int sed_ioctl(struct opal_dev *dev, unsigned int cmd, - unsigned long ptr) + void __user *ioctl_ptr) { return 0; }