Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Ming Lei
On Tue, Jun 28, 2022 at 12:36:17PM -0400, Kent Overstreet wrote: > On Tue, Jun 28, 2022 at 03:49:28PM +0800, Ming Lei wrote: > > On Tue, Jun 28, 2022 at 12:26:10AM -0400, Kent Overstreet wrote: > > > On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > > > > Not mention bio_iter, bvec_iter

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Ming Lei
On Tue, Jun 28, 2022 at 12:13:06PM -0600, Jens Axboe wrote: > On 6/27/22 10:20 PM, Kent Overstreet wrote: > > On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > >> On Sun, Jun 26, 2022 at 04:14:58PM -0400, Kent Overstreet wrote: > >>> On Fri, Jun 24, 2022 at 10:12:52PM +0800, Ming Lei

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 10:54:58AM -0700, Kees Cook wrote: > which must also be assuming it's a header. So probably better to just > drop the driver_data field? I don't see anything using it (that I can > find) besides as a sanity-check that the field exists and is at the end > of the struct.

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Jens Axboe
On 6/27/22 10:20 PM, Kent Overstreet wrote: > On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: >> On Sun, Jun 26, 2022 at 04:14:58PM -0400, Kent Overstreet wrote: >>> On Fri, Jun 24, 2022 at 10:12:52PM +0800, Ming Lei wrote: Commit 7759eb23fd98 ("block: remove bio_rewind_iter()")

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Kees Cook
On Tue, Jun 28, 2022 at 09:27:21AM +0200, Geert Uytterhoeven wrote: > Hi Gustavo, > > Thanks for your patch! > > On Mon, Jun 27, 2022 at 8:04 PM Gustavo A. R. Silva > wrote: > > There is a regular need in the kernel to provide a way to declare > > having a dynamically sized set of trailing

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Kees Cook
On Mon, Jun 27, 2022 at 09:40:52PM -0300, Jason Gunthorpe wrote: > On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > > [...] > > Fyi, this breaks BPF CI: > > > > https://github.com/kernel-patches/bpf/runs/7078719372?check_suite_focus=true > > > > [...] > >

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Mike Snitzer
On Tue, Jun 28 2022 at 12:36P -0400, Kent Overstreet wrote: > On Tue, Jun 28, 2022 at 03:49:28PM +0800, Ming Lei wrote: > > On Tue, Jun 28, 2022 at 12:26:10AM -0400, Kent Overstreet wrote: > > > On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > > > > Not mention bio_iter, bvec_iter has

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Gustavo A. R. Silva
On Mon, Jun 27, 2022 at 12:53:43PM -0700, Stephen Hemminger wrote: > Thanks this fixes warning with gcc-12 in iproute2. > In function ‘xfrm_algo_parse’, > inlined from ‘xfrm_state_modify.constprop’ at xfrm_state.c:573:5: > xfrm_state.c:162:32: warning: writing 1 byte into a region of size 0 >

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Gustavo A. R. Silva
On Tue, Jun 28, 2022 at 10:36:51AM -0300, Jason Gunthorpe wrote: > On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > > > Though maybe we could just switch off > > > > -Wgnu-variable-sized-type-not-at-end during configuration ? > > > We need to think in a different

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Jason Gunthorpe
On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > Though maybe we could just switch off > > > -Wgnu-variable-sized-type-not-at-end during configuration ? > We need to think in a different strategy. I think we will need to switch off the warning in userspace - this is

[dm-devel] dm raid: fix accesses beyond end of raid member array

2022-06-28 Thread Mikulas Patocka
Regarding that patch "dm raid: fix accesses beyond end of raid member array" - are you sure that it passes the testsuite? When I tested it, I got 20 failures (normally, I get 11 failures because I test on Debian and it has some custom udev rules). The failures may have been triggered by some

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Ming Lei
On Tue, Jun 28, 2022 at 12:26:10AM -0400, Kent Overstreet wrote: > On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > > Not mention bio_iter, bvec_iter has been 32 bytes, which is too big to > > hold in per-io data structure. With this patch, 8bytes is enough > > to rewind one bio if the

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Ming Lei
On Tue, Jun 28, 2022 at 12:20:16AM -0400, Kent Overstreet wrote: > On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > > On Sun, Jun 26, 2022 at 04:14:58PM -0400, Kent Overstreet wrote: > > > On Fri, Jun 24, 2022 at 10:12:52PM +0800, Ming Lei wrote: > > > > Commit 7759eb23fd98 ("block:

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Geert Uytterhoeven
Hi Gustavo, Thanks for your patch! On Mon, Jun 27, 2022 at 8:04 PM Gustavo A. R. Silva wrote: > There is a regular need in the kernel to provide a way to declare > having a dynamically sized set of trailing elements in a structure. > Kernel code should always use “flexible array members”[1] for

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Kent Overstreet
On Fri, Jun 24, 2022 at 10:12:52PM +0800, Ming Lei wrote: > Commit 7759eb23fd98 ("block: remove bio_rewind_iter()") removes > the similar API because the following reasons: > > ``` > It is pointed that bio_rewind_iter() is one very bad API[1]: > > 1) bio size may not be restored

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Kent Overstreet
On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > On Sun, Jun 26, 2022 at 04:14:58PM -0400, Kent Overstreet wrote: > > On Fri, Jun 24, 2022 at 10:12:52PM +0800, Ming Lei wrote: > > > Commit 7759eb23fd98 ("block: remove bio_rewind_iter()") removes > > > the similar API because the

Re: [dm-devel] [PATCH 5.20 1/4] block: add bio_rewind() API

2022-06-28 Thread Kent Overstreet
On Mon, Jun 27, 2022 at 03:36:22PM +0800, Ming Lei wrote: > Not mention bio_iter, bvec_iter has been 32 bytes, which is too big to > hold in per-io data structure. With this patch, 8bytes is enough > to rewind one bio if the end sector is fixed. And with rewind, you're making an assumption about