Added one more minor change to this patch to fix the similar signed integer overflow error in unlock_range diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c index c9d8a50062b8..7932354bf90c 100644 --- a/fs/cifs/smb2file.c +++ b/fs/cifs/smb2file.c @@ -111,7 +111,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry)); struct cifsLockInfo *li, *tmp; - __u64 length = 1 + flock->fl_end - flock->fl_start; + __u64 length = cifs_flock_len(flock); struct list_head tmp_llist; INIT_LIST_HEAD(&tmp_llist); also fixed the missing space after the colon in the newly added inline function +static inline u64 cifs_flock_len(struct file_lock *fl) +{ + return fl->fl_end == OFFSET_MAX ? fl->fl_end - fl->fl_start : fl->fl_end - fl->fl_start + 1; +} + On Tue, Aug 10, 2021 at 6:10 PM Steve French wrote: > > How about the following minor change to the recent patch from Paulo - > handling the case where we are doing a whole file lock (BSD lock, > flock) - in which case the original patch would send length of 0 (but > we went to send a byte range lock of the whole file)? > > +static inline u64 cifs_flock_len(struct file_lock *fl) > +{ > + return fl->fl_end == OFFSET_MAX ? fl->fl_end - fl->fl_start: > fl->fl_end - fl->fl_start + 1; > +} > > instead of Paulo's original patch > > +static inline u64 cifs_flock_len(struct file_lock *fl) > +{ > + return fl->fl_end == OFFSET_MAX ? 0: fl->fl_end - fl->fl_start + 1; > +} > > > -- > Thanks, > > Steve -- Thanks, Steve