From patchwork Fri Jan 6 15:59:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9501385 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 1F796606E0 for ; Fri, 6 Jan 2017 15:59:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 202E6284DC for ; Fri, 6 Jan 2017 15:59:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 127C3284EA; Fri, 6 Jan 2017 15:59:53 +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 C6BE7284DC for ; Fri, 6 Jan 2017 15:59:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966782AbdAFP72 (ORCPT ); Fri, 6 Jan 2017 10:59:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43304 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966764AbdAFP7Y (ORCPT ); Fri, 6 Jan 2017 10:59:24 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08F3E8FCFD; Fri, 6 Jan 2017 15:59:25 +0000 (UTC) Received: from tleilax.poochiereds.net (ovpn-116-193.rdu2.redhat.com [10.10.116.193]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v06FxOut025670; Fri, 6 Jan 2017 10:59:24 -0500 From: Jeff Layton To: Al Viro Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iov_iter: add missing handling for ITER_KVEC in iov_iter_single_seg_count Date: Fri, 6 Jan 2017 10:59:22 -0500 Message-Id: <1483718362-18147-1-git-send-email-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 06 Jan 2017 15:59:25 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This seems to currently work by happenstance since kvec and iovec fields basically the same, but it's probably better to make this explicit. Signed-off-by: Jeff Layton --- lib/iov_iter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/iov_iter.c b/lib/iov_iter.c index f2bd21b93dfc..6b415b5a100d 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -738,6 +738,8 @@ size_t iov_iter_single_seg_count(const struct iov_iter *i) return i->count; else if (i->type & ITER_BVEC) return min(i->count, i->bvec->bv_len - i->iov_offset); + else if (i->type & ITER_KVEC) + return min(i->count, i->kvec->iov_len - i->iov_offset); else return min(i->count, i->iov->iov_len - i->iov_offset); }