From patchwork Tue May 18 11:10:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 12264569 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10B46C433B4 for ; Tue, 18 May 2021 11:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E061A610A8 for ; Tue, 18 May 2021 11:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243278AbhERLMW (ORCPT ); Tue, 18 May 2021 07:12:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:58458 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241330AbhERLMW (ORCPT ); Tue, 18 May 2021 07:12:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9E575AF19; Tue, 18 May 2021 11:11:03 +0000 (UTC) Received: from localhost (brahms [local]) by brahms (OpenSMTPD) with ESMTPA id 17e25bfa; Tue, 18 May 2021 11:10:57 +0000 (UTC) From: Luis Henriques To: Alexander Viro Cc: Nicolas Boichat , Amir Goldstein , Olga Kornievskaia , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, 0day robot , kernel test robot , Luis Henriques Subject: [PATCH] vfs: fix early copy_file_range return when len is zero Date: Tue, 18 May 2021 12:10:55 +0100 Message-Id: <20210518111055.16079-1-lhenriques@suse.de> In-Reply-To: <877dk1zibo.fsf@suse.de> References: <877dk1zibo.fsf@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org The early return from copy_file_range when len is zero should check if the filesystem really implements this syscall, returning -EOPNOTSUPP if it doesn't, and 0 otherwise. Reported-by: kernel test robot Signed-off-by: Luis Henriques --- Hi! Since I got not feedback, I'm sending a patch that should fix this issue reported by 0day. Probably this should simply be squashed into v9, I can send v10 if you prefer that. Cheers, -- Luis fs/read_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/read_write.c b/fs/read_write.c index 9db7adf160d2..24b4bf704765 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1498,7 +1498,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in, return ret; if (len == 0) - return 0; + return file_out->f_op->copy_file_range ? 0 : -EOPNOTSUPP; file_start_write(file_out);