lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87efb6ou91.fsf@notabene.neil.brown.name>
Date:   Wed, 28 Nov 2018 12:39:38 +1100
From:   NeilBrown <neilb@...e.com>
To:     David Howells <dhowells@...hat.com>, viro@...iv.linux.org.uk
Cc:     dhowells@...hat.com, linux-afs@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/25] iov_iter: Use accessor function [ver #2]

On Wed, Oct 24 2018, David Howells wrote:

> Use accessor functions to access an iterator's type and direction.  This
> allows for the possibility of using some other method of determining the
> type of iterator than if-chains with bitwise-AND conditions.
>
> Signed-off-by: David Howells <dhowells@...hat.com>
> ---
....
> @@ -74,7 +104,8 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
>  }
>  
>  #define iov_for_each(iov, iter, start)				\
> -	if (!((start).type & (ITER_BVEC | ITER_PIPE)))		\
> +	if (iov_iter_type(start) == ITER_IOVEC ||		\
> +	    iov_iter_type(start) == ITER_KVEC)			\
>  	for (iter = (start);					\
>  	     (iter).count &&					\
>  	     ((iov = iov_iter_iovec(&(iter))), 1);		\

BTW this breaks iov_for_each().
'start' is a struct, but iov_iter_type() requires a pointer to a struct.
You could fix it with
> +	if (iov_iter_type(&start) == ITER_IOVEC ||		\
> +	    iov_iter_type(&start) == ITER_KVEC)			\

but as there are no users it is probably best to discard it.
I discovered this because lustre uses (or rather "used") it.

NeilBrown

From: NeilBrown <neilb@...e.com>
Date: Wed, 28 Nov 2018 12:38:30 +1100
Subject: [PATCH] iov_iter: discard iov_for_each()

iov_for_each has no users and cannot compile
as 'start' is treated sometimes like a struct
and sometimes like a pointer to a struct.

So discard it.

Signed-off-by: NeilBrown <neilb@...e.com>
---
 .clang-format       | 1 -
 include/linux/uio.h | 8 --------
 2 files changed, 9 deletions(-)

diff --git a/.clang-format b/.clang-format
index e6080f5834a3..c144d9c24d5d 100644
--- a/.clang-format
+++ b/.clang-format
@@ -259,7 +259,6 @@ ForEachMacros:
   - 'idr_for_each_entry_ul'
   - 'inet_bind_bucket_for_each'
   - 'inet_lhash2_for_each_icsk_rcu'
-  - 'iov_for_each'
   - 'key_for_each'
   - 'key_for_each_safe'
   - 'klp_for_each_func'
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 55ce99ddb912..a2b2109838b0 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -109,14 +109,6 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
 	};
 }
 
-#define iov_for_each(iov, iter, start)				\
-	if (iov_iter_type(start) == ITER_IOVEC ||		\
-	    iov_iter_type(start) == ITER_KVEC)			\
-	for (iter = (start);					\
-	     (iter).count &&					\
-	     ((iov = iov_iter_iovec(&(iter))), 1);		\
-	     iov_iter_advance(&(iter), (iov).iov_len))
-
 size_t iov_iter_copy_from_user_atomic(struct page *page,
 		struct iov_iter *i, unsigned long offset, size_t bytes);
 void iov_iter_advance(struct iov_iter *i, size_t bytes);
-- 
2.14.0.rc0.dirty


Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ