From patchwork Tue Aug 15 14:43:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mimi Zohar X-Patchwork-Id: 9901977 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 A360560230 for ; Tue, 15 Aug 2017 14:44:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9625928862 for ; Tue, 15 Aug 2017 14:44:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9498528889; Tue, 15 Aug 2017 14:44:40 +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 B5A4828885 for ; Tue, 15 Aug 2017 14:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752519AbdHOOoh (ORCPT ); Tue, 15 Aug 2017 10:44:37 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38373 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752504AbdHOOof (ORCPT ); Tue, 15 Aug 2017 10:44:35 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7FEi0Rv147352 for ; Tue, 15 Aug 2017 10:44:35 -0400 Received: from e23smtp05.au.ibm.com (e23smtp05.au.ibm.com [202.81.31.147]) by mx0a-001b2d01.pphosted.com with ESMTP id 2cbucvdjgs-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 15 Aug 2017 10:44:34 -0400 Received: from localhost by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 16 Aug 2017 00:44:32 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp05.au.ibm.com (202.81.31.211) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 16 Aug 2017 00:44:31 +1000 Received: from d23av06.au.ibm.com (d23av06.au.ibm.com [9.190.235.151]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v7FEiVa442664132; Wed, 16 Aug 2017 00:44:31 +1000 Received: from d23av06.au.ibm.com (localhost [127.0.0.1]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v7FEiUlm022126; Wed, 16 Aug 2017 00:44:31 +1000 Received: from localhost.localdomain.com ([9.80.85.193]) by d23av06.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v7FEiIib021776; Wed, 16 Aug 2017 00:44:27 +1000 From: Mimi Zohar To: Christoph Hellwig , Al Viro Cc: Matthew Garrett , Mimi Zohar , James Morris , linux-fsdevel@vger.kernel.org, linux-ima-devel@lists.sourceforge.net, linux-security-module@vger.kernel.org, Matthew Garrett Subject: [PATCH v6 2/6] efivarfs: replaces the read file operation with read_iter Date: Tue, 15 Aug 2017 10:43:53 -0400 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502808237-2035-1-git-send-email-zohar@linux.vnet.ibm.com> References: <1502808237-2035-1-git-send-email-zohar@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17081514-0016-0000-0000-0000026027C4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17081514-0017-0000-0000-000006E2A3A5 Message-Id: <1502808237-2035-3-git-send-email-zohar@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-15_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708150247 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP In preparation for defining the integrity_read file operation method, replace the read file operation method with read_iter. Suggested-by: Christoph Hellwig Signed-off-by: Mimi Zohar Cc: Matthew Garrett Reviewed-by: Christoph Hellwig --- Changelog v6: - Defined as a separate patch. fs/efivarfs/file.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index 5f22e74bbade..863f1b100165 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c @@ -64,9 +64,10 @@ static ssize_t efivarfs_file_write(struct file *file, return bytes; } -static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, - size_t count, loff_t *ppos) +static ssize_t efivarfs_file_read_iter(struct kiocb *iocb, + struct iov_iter *iter) { + struct file *file = iocb->ki_filp; struct efivar_entry *var = file->private_data; unsigned long datasize = 0; u32 attributes; @@ -96,8 +97,8 @@ static ssize_t efivarfs_file_read(struct file *file, char __user *userbuf, goto out_free; memcpy(data, &attributes, sizeof(attributes)); - size = simple_read_from_buffer(userbuf, count, ppos, - data, datasize + sizeof(attributes)); + size = simple_read_iter_from_buffer(iocb, iter, data, + datasize + sizeof(attributes)); out_free: kfree(data); @@ -174,7 +175,7 @@ efivarfs_file_ioctl(struct file *file, unsigned int cmd, unsigned long p) const struct file_operations efivarfs_file_operations = { .open = simple_open, - .read = efivarfs_file_read, + .read_iter = efivarfs_file_read_iter, .write = efivarfs_file_write, .llseek = no_llseek, .unlocked_ioctl = efivarfs_file_ioctl,