Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp512955yba; Wed, 24 Apr 2019 05:19:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqw+OyMxGRrGqDYPA6XUjx8NW7GwrwazqYJq6qRRTYjnwPCeDqC8AVCbXpE2SqKPWuSVFryz X-Received: by 2002:a17:902:9a4a:: with SMTP id x10mr31531801plv.113.1556108347571; Wed, 24 Apr 2019 05:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556108347; cv=none; d=google.com; s=arc-20160816; b=hCECYgdIZK5wuGPDo/AVlL/y/UXM/ALrWgyCu68+eg1A3C3oh5jPF1HEn11jMW48lr Ramk/sTPlh601KDAABij7DvPoUXnQiynatuotT8VEEAI3UyQQwQlHdhHy5PIPaUxKvsS wGbOEwXz/UMAIT4FVsl3dTwMENAQLGigH+hmZOmOvaqviDcIPIeK8bkmROBWDbXR2NKC UUs9VK1mddGKlH2mF0e+7RbnsCZkPXhF9NFpzKCq6adz5ONm/4obQq79INxnzFOuRWUl d8T5fb1KfGHyYozDTUqyqMudwE3EST5BQbXkcIDS2NwkS8hIKoEy1VH/occ668uoU2lM xrfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uA6iErvAE8AmCa3oijlBpPGbD0Ahz2hRAshYo94dYbc=; b=LGq4MYcxnLNmqQwCSNy/BM6jRswz83gKqEbI+6E/oBd4btrSiDnI9VwPm+nOCj+uX8 TyQKNkyL7Xc6y98vk2GVyqPW2CdhWt3uPvjJw6EhJcpmkTgWOYltRPbICkWqBCf6913y XVAb5AXLH2GeJtwRc7zYDC7WZsLFDTa+EIzfchXE7G6kWHOMzRHLaPnmcev9OK0zCo/s Dch1ADeNEU7tLrwSb+RsGdxPi9t2qZDbPbjyYaAAqTx5248Z55yYIsqFf5QLQiOaMrJa 8tNjJK9sV4C94pwtOFpiHqY57SqPjf21OXzTZmQKT9R8yMOn7ZKwIPB6nFSGJ4IiWCsM kzMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bkWHZaxV; 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 b61si18788985plb.22.2019.04.24.05.18.51; Wed, 24 Apr 2019 05:19:07 -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=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=bkWHZaxV; 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 S1729507AbfDXMRm (ORCPT + 99 others); Wed, 24 Apr 2019 08:17:42 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:54015 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729389AbfDXMRl (ORCPT ); Wed, 24 Apr 2019 08:17:41 -0400 Received: by mail-it1-f193.google.com with SMTP id z4so1663423itc.3 for ; Wed, 24 Apr 2019 05:17:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uA6iErvAE8AmCa3oijlBpPGbD0Ahz2hRAshYo94dYbc=; b=bkWHZaxVdUbxDSpIE8J/X5ZcIj0oYDegfTR67MOvm8G62+5HvF4saaYPm8ynItm5kN G20Xi4/aqfZ+4/jmbMANbTdGAhnppMsupMAnEHs/k9teLYIMLRlH8I/QWAaVAWe9sOTy 3hGOzjwY8WBO0Hk1qyz4N/eaUaYbaCKXz374Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uA6iErvAE8AmCa3oijlBpPGbD0Ahz2hRAshYo94dYbc=; b=aHMRipg+kbox6iYNEMssxRDIUoof3j2Vae8+AGInliEOvQRPDBr1SvJPss0Y2+tdn2 WPysYTHDdyRIOrx77H4g9TFeZ3U7/Omb5HLpGxPzYO5kea/UZdaCDlKz7hx7qBGCplvs QythB0DZRwCmEru5P+kvHfyo08Vvx3fxiDfSBG2OaxXGuOnYb6R8ZW4L820SzddEE/mM 5/P2TO33+qqDvrZ2KCPJLSFPW+wgopAy8QSccmPrJpxvlVKVY2N+JxkeD0kT4aJ67NXI 3q5nKfKY2tqO9PWrK3KBTZr9YlFLm/7QhKCdQfO6EdmznXVAVBU5ncFl8IMASupZPH/T z6Ew== X-Gm-Message-State: APjAAAWQ6di99LJ2k/sSBVGMf0MJB9E5WB/gU+GmEfYvJ0IPc/0zkg/L xG3f67IJTkB33h4dxl09yXYcDl9s8Lk+1AAPIgvg2g== X-Received: by 2002:a24:1342:: with SMTP id 63mr6039085itz.69.1556108260820; Wed, 24 Apr 2019 05:17:40 -0700 (PDT) MIME-Version: 1.0 References: <12f7d0d98555ee0d174d04bb47644f65c07f035a.1553680185.git.kirr@nexedi.com> <20190424115620.GA2723@deco.navytux.spb.ru> In-Reply-To: <20190424115620.GA2723@deco.navytux.spb.ru> From: Miklos Szeredi Date: Wed, 24 Apr 2019 14:17:27 +0200 Message-ID: Subject: Re: [RESEND4, PATCH 1/2] fuse: retrieve: cap requested size to negotiated max_write To: Kirill Smelkov Cc: Miklos Szeredi , Han-Wen Nienhuys , Jakob Unterwurzacher , Kirill Tkhai , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, fuse-devel , stable Content-Type: text/plain; charset="UTF-8" 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 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_conn *fc, struct inode *inode, > unsigned int offset; > size_t total_len = 0; > unsigned int num_pages; > > offset = outarg->offset & ~PAGE_MASK; > file_size = i_size_read(inode); > > - num = outarg->size; > + num = min(outarg->size, fc->max_write); > if (outarg->offset > file_size) > num = 0; > else if (outarg->offset + num > file_size) > num = file_size - outarg->offset; <-- THIS > > num_pages = (num + offset + PAGE_SIZE - 1) >> PAGE_SHIFT; > num_pages = min(num_pages, fc->max_pages); > > and then in this case (offset + num > file_size) num overwrite > > num = file_size - offset > > can make num only smaller, right? And then the patch is not wrong because there > is no other num overwriting in this function except when num is being further > decremented in loop that prepares pages to retrieve. You're right, of course. > > 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. Thanks, Miklos