Re: [PATCH v4 01/10] loop: Factor out loop size validation

2020-05-01 Thread Christoph Hellwig
On Wed, Apr 29, 2020 at 10:12:29PM +0800, Ming Lei wrote: > > +static int > > +loop_validate_size(loff_t size) > > +{ > > + if ((loff_t)(sector_t)size != size) > > + return -EFBIG; > > + > > + return 0; > > +} > > + > > Now sector_t has been switched to u64 unconditionally, do we sti

Re: [PATCH v4 01/10] loop: Factor out loop size validation

2020-05-01 Thread Martijn Coenen
Hi Ming, On Wed, Apr 29, 2020 at 4:12 PM Ming Lei wrote: > Now sector_t has been switched to u64 unconditionally, do we still need such > validation? I think you're right; I hadn't seen that change, but truncating because of sector_t shouldn't be an issue anymore. I wondered if we could actually

Re: [PATCH v4 01/10] loop: Factor out loop size validation

2020-04-29 Thread Ming Lei
On Wed, Apr 29, 2020 at 04:03:32PM +0200, Martijn Coenen wrote: > Ensuring we don't truncate loff_t when casting to sector_t is done in > multiple places; factor it out. > > Signed-off-by: Martijn Coenen > --- > drivers/block/loop.c | 25 - > 1 file changed, 20 insertions

[PATCH v4 01/10] loop: Factor out loop size validation

2020-04-29 Thread Martijn Coenen
Ensuring we don't truncate loff_t when casting to sector_t is done in multiple places; factor it out. Signed-off-by: Martijn Coenen --- drivers/block/loop.c | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c