Re: [PATCH] cifs: add support for FALLOC_FL_COLLAPSE_RANGE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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...?)

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)





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux