On Wed, Mar 31, 2021 at 12:22 AM Aurélien Aptel <aaptel@xxxxxxxx> wrote: > > Ronnie Sahlberg <lsahlber@xxxxxxxxxx> writes: > > +static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon, > > + loff_t off, loff_t len) > > +{ > > + int rc; > > + unsigned int xid; > > + struct cifsFileInfo *cfile = file->private_data; > > + __le64 eof; > > + > > + xid = get_xid(); > > + > > + if (off + len < off) { > > + rc = -EFBIG; > > + goto out; > > + } > > loff_t is defined as 'long long' for me which is signed, and signed > overflow is Undefined Behaviour, unless we compile with -fwrapv which > I'm not sure it is something we can assume. > > Also, vfs_fallocate() in fs/open.c already does an overflow check before > calling f_op->falloc(), this is probably not needed. (It's also relying > on signed overflow so I guess it is ok...?) Thanks. Steve, can you drop this check from the patch? > > Rest of the patch looks good otherwise. > > Cheers, > -- > Aurélien Aptel / SUSE Labs Samba Team > GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 > SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE > GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München) >