From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT 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 0F5A5C282C4 for ; Mon, 4 Feb 2019 11:34:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD84020823 for ; Mon, 4 Feb 2019 11:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728122AbfBDLeO (ORCPT ); Mon, 4 Feb 2019 06:34:14 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46513 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727231AbfBDLeO (ORCPT ); Mon, 4 Feb 2019 06:34:14 -0500 Received: by mail-wr1-f67.google.com with SMTP id l9so13931959wrt.13 for ; Mon, 04 Feb 2019 03:34:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PlvTQas6Q/WO2xTZKdFHc44CL6+58dTLHN/7EYFvdWQ=; b=XTh+MBxpBgdx+nqYVErnE45UDOvEL2gjTzikzus3AX88GGlF61w9t3+J7uFrJjhq94 0rWFr90/SySEqY6bHlBXUsq7UjUxf4wo7bQoL8nRea8jCFvayaZBl+RvgUfxTDvijBMH sd1yiWHJpJzWXSPwFkimzhQ8ieXIVX5+THSL+ju4o7eDtHaJIYxCMvgVE9awoTEmYTdo Ifex7q9ErHLJHLa5vdSy0XPgBq+KdQTfHl+B3fe2Nx/tDwv64i6fJBvF/cSbx4U9nhCm rHXVV1xiL+ftLTipDU0mhpPROTaiwkLJpPFOiJmWF28VF2mKNp09QmvCNUrtl9z6euFU Ktmg== X-Gm-Message-State: AHQUAuYyJzDBd7GE1clnNS8v8bMtbEQg3Ygm7xoYY20Lz+vOOYZYrwz/ Qu3eHv8CATasNJ+KVBaLMWzzTQ== X-Google-Smtp-Source: AHgI3IbqBdZxnxVV9VPVBm43ii/7IIKoSNWf0miGdSibmMnKLM6n7k+Ez+WBkCPBeI9Vc8I5Bm9fZA== X-Received: by 2002:adf:b749:: with SMTP id n9mr1581948wre.49.1549280052235; Mon, 04 Feb 2019 03:34:12 -0800 (PST) Received: from hades.usersys.redhat.com (ip-89-103-126-188.net.upcbroadband.cz. [89.103.126.188]) by smtp.gmail.com with ESMTPSA id l21sm6460790wmh.29.2019.02.04.03.34.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Feb 2019 03:34:10 -0800 (PST) Date: Mon, 4 Feb 2019 12:34:08 +0100 From: Carlos Maiolino To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, adilger@dilger.ca, sandeen@redhat.com, david@fromorbit.com Subject: Re: [PATCH 04/10 V2] fibmap: Use bmap instead of ->bmap method in ioctl_fibmap Message-ID: <20190204113408.rhp7ga2bp7mskls3@hades.usersys.redhat.com> References: <20181205091728.29903-1-cmaiolino@redhat.com> <20181205091728.29903-5-cmaiolino@redhat.com> <20190114164902.GA7187@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190114164902.GA7187@lst.de> User-Agent: NeoMutt/20180716 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Hi Christoph. Sorry for the delayed reply. > > + error = get_user(usr_blk, p); > > + if (error) > > + return error; > > Does get_user/put_user actually return an error? > > All the code I know just does: > > if (get_user())) > return -EFAULT; > > and co. According to the comment above it, it either returns zero on success, or -EFAULT on error. So, both approaches are correct, either mine, or the one you mentioned. It just seems more logical to me, to return whatever error code returned by the function (well, macro), instead of hardcoding -EFAULT. > > > + > > + block = usr_blk; > > + error = bmap(inode, &block); > > + if (error) > > + return error; > > + usr_blk = block; > > Nitpick: maybe i'd name ur_block block and block sector, which seems > to flow a little better. Sure, it's ok for me, I'll change that on a V3 > -- Carlos