Received: by 10.192.165.148 with SMTP id m20csp2970040imm; Mon, 7 May 2018 04:33:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqWHx0nDk+USTch4oR2wyRbaCeINzEYDO5/I7eFmr64gMnWNePAeg84ARPZF9C21RjaN6ua X-Received: by 2002:a17:902:8a:: with SMTP id a10-v6mr37325302pla.89.1525692838485; Mon, 07 May 2018 04:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525692838; cv=none; d=google.com; s=arc-20160816; b=QVyYpp6T8991bGlK1V+g2BXpV9h0bd/FNia1CdRpzx6bTCcFMKDEHwCQcLDV5RvwBt 0Q+uDVRVJpLmGavJlkYYu920H6h7HVTsMUHa+uDEK6YBvZhaYzY0mXYNz9qkVTnyqp74 W16kgTbl8nwYyQNMBJ3keVvSjuq/Ri7vA2kJ8/zSoWHyqyjsrOEY2Z8f0r1p4xZo3rOO 8a0v5b6qCg92ej39NhNLMatDvZAhj/fWlf3uZrf8RpGiFGkA3dyG80rNnpzYOqFTL8FF SpuGl9WsWzdJlNDwJRrRtVgJULxOHHbyNah2gVzDuzXote8Mpo7z8ZNdWe9HkjNuS3iw aZzg== 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 :references:in-reply-to:mime-version:arc-authentication-results; bh=w+dd4uxn40E8oZdgsueHUZtN9gNTDN7xrV227qVEE8M=; b=UI0pwFVKsv7fXTNXclJWAgXU1nhL6exrlHUo3jY9lhEX4yKhvOcBIPz7P/o6V7IXQ/ K6/6neNf6FFMLmfzgDMT/JgNFWfNFn/1xbISPzTC13RC3IAE8JK6sBuOOn7zFIDTGjHm aOGCZOjKs+9LM2Xu/WVkBM02XHHAKwKbwbJnzAgTTL3+UEIxpjkv4fmY5hXzASFNDkqt jAbGxDulFePAzhVTk9O4LuM8ys+wb150Z5ZyZcIoh4mmN3SnWtxlPDfOsaQYM73/P0j6 FJqKo0nmUd5iCb4t5wdw5aTmcxlp9J1SwI+G+4DE/A6byj3Wtq2JKxz6pMx0FDit78Wq /sUw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si12524217pfm.110.2018.05.07.04.33.44; Mon, 07 May 2018 04:33:58 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752191AbeEGLcN (ORCPT + 99 others); Mon, 7 May 2018 07:32:13 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34223 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752166AbeEGLcK (ORCPT ); Mon, 7 May 2018 07:32:10 -0400 Received: by mail-oi0-f67.google.com with SMTP id l1-v6so24772107oii.1 for ; Mon, 07 May 2018 04:32:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=w+dd4uxn40E8oZdgsueHUZtN9gNTDN7xrV227qVEE8M=; b=GNT7fWhiu3cYWaxgJ03JsOZU04XGcN9YPfnLKzt3XBO1v+AXj9mraoBiPeMkh0X/uL WlCtSMM6ikDNMjJtK0nHgXiHZ1bPWBC9fDx3jo95aAyMD+8k/Foz85AiXx/RgUT0IfER ngbx/X9SiJMTG5mrrcpYdN69O1hQ/ulD+/5mWaWOvN5IpwUVpB+wQ5UYHrI7/kPQDWzs p2g3F0yNXJailQEw+6Z8z4POX8tQs7NQxU3eBS/sZpCu26OtRq+h+OSrM25NvhJtS4H/ q+RzrP9hRq43cvHoHhig2FbaiucRi9Q5jwF4WaCvzlgiYmoXxOCYe6iLje21KAje0rsd Uj7A== X-Gm-Message-State: ALQs6tASpCazo8u2N2ky8VPXzvp6Yo2C7QIPtWdMyiBUbMeZ4MFU4ttH xMt4Vx92aW2XKSyiKHe40KKBeucwXlw9GWNx7zx+dw== X-Received: by 2002:aca:c589:: with SMTP id v131-v6mr24133982oif.92.1525692729782; Mon, 07 May 2018 04:32:09 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:58cd:0:0:0:0:0 with HTTP; Mon, 7 May 2018 04:32:09 -0700 (PDT) In-Reply-To: <20180507111142.GA18116@bombadil.infradead.org> References: <20180507082108.28186-1-mszeredi@redhat.com> <20180507082108.28186-2-mszeredi@redhat.com> <20180507111142.GA18116@bombadil.infradead.org> From: Miklos Szeredi Date: Mon, 7 May 2018 13:32:09 +0200 Message-ID: Subject: Re: [PATCH 1/3] vfs: dedpue: return s64 To: Matthew Wilcox Cc: Al Viro , linux-fsdevel , lkml , Amir Goldstein 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 Mon, May 7, 2018 at 1:11 PM, Matthew Wilcox wrote: > On Mon, May 07, 2018 at 10:21:06AM +0200, Miklos Szeredi wrote: >> f_op->dedupe_file_range() gets a u64 length to dedup and returns an ssize_t >> actual length deduped. This breaks badly on 32bit archs since the returned >> length will be truncated and possibly overflow into the sign bit (xfs and >> ocfs2 are affected, btrfs limits actual length to 16MiB). >> >> Returning s64 should be good, since clone_verify_area() makes sure that the >> supplied length doesn't overflow. > > Why s64 rather than loff_t? Particularly since the next patch turns > the paramters into loff_t. Next patch turns the offsets into loff_t and leaves "len" as u64. A size is definitely not an offset, I'd consider changing the type of "len" to loff_t a misuse. Thanks, Miklos