Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp560114yba; Wed, 24 Apr 2019 06:04:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzcaY7sDnqTswmrpDHJIa2YP3sIt3YcaZzACQlhjMdOFDYEjtukGlsY8QomZVwrX73iYo9y X-Received: by 2002:a17:902:2ba6:: with SMTP id l35mr27747928plb.56.1556111091477; Wed, 24 Apr 2019 06:04:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556111091; cv=none; d=google.com; s=arc-20160816; b=DWYfTlrZcnFRjo56CbMEuifwO57EqbQjiLmxL0jQQIUL3aVuth4n+RKmPkviwjrxk7 1lafHDCFNHMyEBPHCQnihzF/pLsaEuWe5LaTaTMywmPxtZmkyNYuIWNDvzBPm/xcPcJ3 hjOAHJCiNkhkaueGEs8Xb9E0xb/OGaQlqYdw2lZyfqmLyx5Eg4U+jbfA5aINPCxU/ACP FIDOHJKdLOKMITRc9NizPKyGksdDBP174TAr0ToUp9LXTkahbIQlUbvdYpahrOzkSZXg gBMNZA8XS7YupLhCZqG8lSFBXxBDSWwrlxMrVOd9gwLXmWSF/0l2fyQqhK+qJL7z1J7B 1D7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :date:in-reply-to:references:message-id:cc:to:subject:from :dkim-signature:dkim-signature; bh=meBFEY5ggbjVcToDIenTK6mDefScwokuA5qfAcGfUUY=; b=z0udevuKvLIAcBdLk1cP6JEEf1FZ1qpxJi0OXb1qAd848dUUVAUjNqNq1TQpyaawrJ 7eAmejrLunx8wahEvFisITOjhk6zVD8u55kG00TxpYrldWfhUp08VNH3+SQDJ1qLgtZf NOBul08Pnp5mxG2m8lDvFR2FNy9UlnW4PXnO/xoQx6am79XDhkOWgKEHTLZPMRQ3oWhN U3LQwIsSRI1F/0o3FI1tSfRg7F1H1qTTCRMv/ZJV6sYFG6WHMvlmhnlC7CeV3ZQkHZG/ x6cnYhaejcmfpyLibsRiKWe8vkREaB4iEAJhaSRDEVJNXFFKnLdQKWVNk+8ra6PFpY7Q +Gkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nexedi.com header.s=mandrill header.b="PD/RlD2l"; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=ZEnYug7t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v2si17871162plp.191.2019.04.24.06.04.28; Wed, 24 Apr 2019 06:04:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nexedi.com header.s=mandrill header.b="PD/RlD2l"; dkim=pass header.i=@mandrillapp.com header.s=mandrill header.b=ZEnYug7t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730347AbfDXNBS (ORCPT + 99 others); Wed, 24 Apr 2019 09:01:18 -0400 Received: from mail133-30.atl131.mandrillapp.com ([198.2.133.30]:32732 "EHLO mail133-30.atl131.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728842AbfDXNBR (ORCPT ); Wed, 24 Apr 2019 09:01:17 -0400 X-Greylist: delayed 1802 seconds by postgrey-1.27 at vger.kernel.org; Wed, 24 Apr 2019 09:01:16 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=mandrill; d=nexedi.com; h=From:Subject:To:Cc:Message-Id:References:In-Reply-To:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; i=kirr@nexedi.com; bh=meBFEY5ggbjVcToDIenTK6mDefScwokuA5qfAcGfUUY=; b=PD/RlD2ljQ/xV95Ckx0J8gMLpRYg4Hh8h2rJ1lVgEpyM6pWSA1dIGiDHMaBvFkhhY/AqwQrrMtYp IWHR5DzjPBukq22JifMU2VMrkEVzWJzjtwrPJZMkN41hMUFBo1LUlaDWBZ3Nl9KbPz1+vgCWEyy/ gZc2RmYwbKXlsMmKre8= Received: from pmta02.mandrill.prod.atl01.rsglab.com (127.0.0.1) by mail133-30.atl131.mandrillapp.com id ho1f1o1sar8q for ; Wed, 24 Apr 2019 12:31:14 +0000 (envelope-from ) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; i=@mandrillapp.com; q=dns/txt; s=mandrill; t=1556109074; h=From : Subject : To : Cc : Message-Id : References : In-Reply-To : Date : MIME-Version : Content-Type : Content-Transfer-Encoding : From : Subject : Date : X-Mandrill-User : List-Unsubscribe; bh=meBFEY5ggbjVcToDIenTK6mDefScwokuA5qfAcGfUUY=; b=ZEnYug7tD8j6bE4lkDHlw4/mfENzgqhNcvU21JG/WfHn7rMBIBE23USgPMw+ynvREm9IrA Nmlh3jrwrCPi/j6zde+uKzO2WV3m2BFTNn8tC5IXrOfhzms8ae4OPCAZZNgUlQy8mx3LSbEW 8Ri1oSG4S0HxVr+/4BZCQFU0z7gYQ= From: Kirill Smelkov Subject: Re: [RESEND4, PATCH 1/2] fuse: retrieve: cap requested size to negotiated max_write Received: from [87.98.221.171] by mandrillapp.com id 86baa58cb2be4fbcb1652ad452d7ce99; Wed, 24 Apr 2019 12:31:14 +0000 To: Miklos Szeredi Cc: Miklos Szeredi , Han-Wen Nienhuys , Jakob Unterwurzacher , Kirill Tkhai , Andrew Morton , , , fuse-devel , stable Message-Id: <20190424123107.GA32024@deco.navytux.spb.ru> References: <12f7d0d98555ee0d174d04bb47644f65c07f035a.1553680185.git.kirr@nexedi.com> <20190424115620.GA2723@deco.navytux.spb.ru> In-Reply-To: X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=31050260.86baa58cb2be4fbcb1652ad452d7ce99 X-Mandrill-User: md_31050260 Date: Wed, 24 Apr 2019 12:31:14 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 24, 2019 at 02:17:27PM +0200, Miklos Szeredi wrote: > On Wed, Apr 24, 2019 at 1:56 PM Kirill Smelkov wrote: > > > I assume you are meaning this: > > > > --- a/fs/fuse/dev.c > > +++ b/fs/fuse/dev.c > > @@ -1745,15 +1745,15 @@ static int fuse_retrieve(struct fuse_co= nn *fc, struct inode *inode, > > unsigned int offset; > > size_t total_len =3D 0; > > unsigned int num_pages; > > > > offset =3D outarg->offset & ~PAGE_MASK; > > file_size =3D i_size_read(inode); > > > > - num =3D outarg->size; > > + num =3D min(outarg->size, fc->max_write); > > if (outarg->offset > file_size) > > num =3D 0; > > else if (outarg->offset + num > file_size) > > num =3D file_size - outarg->offset; = <-- THIS > > > > num_pages =3D (num + offset + PAGE_SIZE - 1) >> PAGE_SH= IFT; > > num_pages =3D min(num_pages, fc->max_pages); > > > > and then in this case (offset + num > file_size) num overwrite > > > > num =3D file_size - offset > > > > can make num only smaller, right? And then the patch is not wrong becau= se there > > is no other num overwriting in this function except when num is being f= urther > > decremented in loop that prepares pages to retrieve. > > You're right, of course. Thanks. Does it mean that the patch is ok? Do I need to rework something? > > > Also the patch is whitespace damaged. > > > > I've tried to do the following in my mutt on "RESEND4, PATCH 1/2" > > message: > > > > |(cd ~/src/linux/linux && git am -) > > > > and the patch applied successfully. So could you please clarify what > > "whitespace damaged" means? > > Hmm, apparently this (and only this) message is "quoted-printable" > encoded. git-am seems to handle it fine, but my script doesn't. > Anyway, I'll do it manually. I see. Probably it is not "quoted-printable" as =09Content-Type: text/plain; charset=3Dutf-8 =09Content-Transfer-Encoding: 8bit suggests and it is maybe due to UTF-8 characters (I used "=C2=B7" several times in patch description). Anyway if it helps you can pull the patch from here =09https://lab.nexedi.com/kirr/linux.git=09y/fuse-retrieve-cap-max_write =09 and then cherry-pick it (git cherry-pick fd482f96537a) to where needed. Thanks again for feedback, Kirill