[PATCH] iov_iter: fix bad parenthesis placement for iter_type check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to some unfortunate placement of the parenthesis for the iter_type
check in iov_iter_restore(), we can generate spurious triggers of the
type WARN_ON_ONCE() even if the iter is of the correct type.

While in there, correct the comment on what types can be used with the
save/restore helpers, and fix an extra word in the function description.

Fixes: 6696361cc3d8 ("new iov_iter flavour - ITER_UBUF")
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>

---

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 0973c622d3c0..f569190f8685 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -1925,15 +1925,15 @@ int import_ubuf(int rw, void __user *buf, size_t len, struct iov_iter *i)
  * @i: &struct iov_iter to restore
  * @state: state to restore from
  *
- * Used after iov_iter_save_state() to bring restore @i, if operations may
- * have advanced it.
+ * Used after iov_iter_save_state() to restore @i, if operations may have
+ * advanced it.
  *
- * Note: only works on ITER_IOVEC, ITER_BVEC, and ITER_KVEC
+ * Note: only works on ITER_IOVEC, ITER_BVEC, ITER_KVEC, and ITER_UBUF.
  */
 void iov_iter_restore(struct iov_iter *i, struct iov_iter_state *state)
 {
-	if (WARN_ON_ONCE(!iov_iter_is_bvec(i) && !iter_is_iovec(i)) &&
-			 !iov_iter_is_kvec(i) && !iter_is_ubuf(i))
+	if (WARN_ON_ONCE(!iov_iter_is_bvec(i) && !iter_is_iovec(i) &&
+			 !iov_iter_is_kvec(i) && !iter_is_ubuf(i)))
 		return;
 	i->iov_offset = state->iov_offset;
 	i->count = state->count;

-- 
Jens Axboe




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux