All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Aurélien Aptel" <aaptel@suse.com>
To: Ronnie Sahlberg <lsahlber@redhat.com>,
	linux-cifs <linux-cifs@vger.kernel.org>
Cc: Steve French <smfrench@gmail.com>
Subject: Re: [PATCH] cifs: add support for FALLOC_FL_COLLAPSE_RANGE
Date: Tue, 30 Mar 2021 16:21:07 +0200	[thread overview]
Message-ID: <87eefwpvsc.fsf@suse.com> (raw)
In-Reply-To: <20210326195229.114110-1-lsahlber@redhat.com>

Ronnie Sahlberg <lsahlber@redhat.com> 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)


  reply	other threads:[~2021-03-30 14:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 19:52 [PATCH] cifs: add support for FALLOC_FL_COLLAPSE_RANGE Ronnie Sahlberg
2021-03-30 14:21 ` Aurélien Aptel [this message]
2021-03-30 22:09   ` ronnie sahlberg
2021-03-30 22:15     ` Steve French
2021-04-01  5:41 ` Steve French
  -- strict thread matches above, loose matches on Subject: below --
2021-03-26  7:40 kernel test robot
2021-03-26  1:31 Ronnie Sahlberg
2021-03-26  5:58 ` kernel test robot
2021-03-26  5:58   ` kernel test robot
2021-03-26  8:35 ` Dan Carpenter
2021-03-26  8:35   ` Dan Carpenter
2021-03-26  8:35   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eefwpvsc.fsf@suse.com \
    --to=aaptel@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lsahlber@redhat.com \
    --cc=smfrench@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.