From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934129AbcLMSje convert rfc822-to-8bit (ORCPT ); Tue, 13 Dec 2016 13:39:34 -0500 Received: from mail.sigma-star.at ([95.130.255.111]:45996 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932250AbcLMSjc (ORCPT ); Tue, 13 Dec 2016 13:39:32 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [PATCH 2/2] ubifs: Use fscrypt ioctl() helpers From: David Gstir In-Reply-To: <20161212232759.30239-2-richard@nod.at> Date: Tue, 13 Dec 2016 19:39:33 +0100 Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, adrian.hunter@intel.com, dedekind1@gmail.com Content-Transfer-Encoding: 8BIT Message-Id: <6865661F-911A-4BF9-B60B-D5605AD6F382@sigma-star.at> References: <20161212232759.30239-1-richard@nod.at> <20161212232759.30239-2-richard@nod.at> To: Richard Weinberger X-Mailer: Apple Mail (2.3124) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 13.12.2016, at 00:27, Richard Weinberger wrote: > > Commit db717d8e26c2 ("fscrypto: move ioctl processing more fully into > common code") moved ioctl() related functions into fscrypt and offers > us now a set of helper functions. > > Signed-off-by: Richard Weinberger > --- > fs/ubifs/ioctl.c | 24 ++---------------------- > fs/ubifs/ubifs.h | 4 ++-- > 2 files changed, 4 insertions(+), 24 deletions(-) > > diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c > index 3d10f5525274..78d713644df3 100644 > --- a/fs/ubifs/ioctl.c > +++ b/fs/ubifs/ioctl.c > @@ -184,39 +184,19 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) > case FS_IOC_SET_ENCRYPTION_POLICY: { > #ifdef CONFIG_UBIFS_FS_ENCRYPTION > struct ubifs_info *c = inode->i_sb->s_fs_info; > - struct fscrypt_policy policy; > - > - if (copy_from_user(&policy, > - (struct fscrypt_policy __user *)arg, > - sizeof(policy))) > - return -EFAULT; > > err = ubifs_enable_encryption(c); > if (err) > return err; > > - err = fscrypt_process_policy(file, &policy); > - > - return err; > + return fscrypt_ioctl_set_policy(file, (const void __user *)arg); > #else > return -EOPNOTSUPP; > #endif > } > case FS_IOC_GET_ENCRYPTION_POLICY: { > #ifdef CONFIG_UBIFS_FS_ENCRYPTION > - struct fscrypt_policy policy; > - > - if (!ubifs_crypt_is_encrypted(inode)) > - return -ENOENT; > - > - err = fscrypt_get_policy(inode, &policy); > - if (err) > - return err; > - > - if (copy_to_user((void __user *)arg, &policy, sizeof(policy))) > - return -EFAULT; > - > - return 0; > + return fscrypt_ioctl_get_policy(file, (void __user *)arg); > #else > return -EOPNOTSUPP; > #endif > diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h > index 8d0e4818e3ea..ca72382ce6cc 100644 > --- a/fs/ubifs/ubifs.h > +++ b/fs/ubifs/ubifs.h > @@ -1806,8 +1806,8 @@ int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len, > #define fscrypt_pullback_bio_page fscrypt_notsupp_pullback_bio_page > #define fscrypt_restore_control_page fscrypt_notsupp_restore_control_page > #define fscrypt_zeroout_range fscrypt_notsupp_zeroout_range > -#define fscrypt_process_policy fscrypt_notsupp_process_policy > -#define fscrypt_get_policy fscrypt_notsupp_get_policy > +#define fscrypt_ioctl_set_policy fscrypt_notsupp_ioctl_set_policy > +#define fscrypt_ioctl_get_policy fscrypt_notsupp_ioctl_get_policy > #define fscrypt_has_permitted_context fscrypt_notsupp_has_permitted_context > #define fscrypt_inherit_context fscrypt_notsupp_inherit_context > #define fscrypt_get_encryption_info fscrypt_notsupp_get_encryption_info > -- > 2.10.2 Looks good to me. Reviewed-by: David Gstir - David