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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 D626CC48BE8 for ; Fri, 18 Jun 2021 21:41:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B721261284 for ; Fri, 18 Jun 2021 21:41:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234606AbhFRVnV (ORCPT ); Fri, 18 Jun 2021 17:43:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbhFRVnU (ORCPT ); Fri, 18 Jun 2021 17:43:20 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4139C06175F for ; Fri, 18 Jun 2021 14:41:09 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 131so15892246ljj.3 for ; Fri, 18 Jun 2021 14:41:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1r2JNcGiZYGEsYXKAn8qdNAkS9jkXxdkGrKjRmIacM0=; b=W9WgSMPNxsi6UNVwDFOvRq4okEhNaCNzDakMc0cvqSwcUVgvkkcz8ZcfCsH+hgFs5k M687Bx4DVFcOT3GjS/qoFgbSOFd1xSAEce+22UPK2itBj11GTffU3KUg8hTc6ns7oObl GTyi3Kk1pl2MJYCc42QRxWGeDH/y3b0qmQLpM= 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=1r2JNcGiZYGEsYXKAn8qdNAkS9jkXxdkGrKjRmIacM0=; b=kKmWRWiiZuDcXFi1pu3d8mOqOrNsXB6siKWDGH0bJsoK1Fxh4ttFIJa40PYtnBzIgm wFn0NFjuLEjYh2VgHlPJHc3tu1BgKrihukgx4eOr74PvIu6ieJwHcwdJkUqhebCXUNeN lTtwdsyoO9h7KoXR4e6B6xrGCfqIFRQjjAPK9QjDlzMcyOAhfLGJf69r1nYuWht0/eZg fLkRmT0geFBXbd4bdmyDCdQiXB2rFagg2+6xu/JYrhPo/hnjc5JIMeW6GGabmHGfx1jq TwvcgSp8DPrb4vkkWnnItvbgZdqT+kCfwhBif33cYl0ryqQpB18Qu93nO9Lrs2sD7RQh AWAg== X-Gm-Message-State: AOAM533SPSIhY/wJyFo4xbl61bpPCriBVw1LHBO8tkRcRmLwRW6+09tZ wS9+a4JPGKvLcF+6qi5PEXCaLsKIcY8PjlSY X-Google-Smtp-Source: ABdhPJyz2j+lhm9z9SZFiruHHwytQYKLjc+TKTB5o/9yMksBWlfTepPLleLpSLeEKnNmVokGey2Dsg== X-Received: by 2002:a2e:844a:: with SMTP id u10mr11336657ljh.443.1624052467860; Fri, 18 Jun 2021 14:41:07 -0700 (PDT) Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com. [209.85.208.180]) by smtp.gmail.com with ESMTPSA id u10sm22005lfg.240.2021.06.18.14.41.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Jun 2021 14:41:07 -0700 (PDT) Received: by mail-lj1-f180.google.com with SMTP id c11so15863196ljd.6 for ; Fri, 18 Jun 2021 14:41:07 -0700 (PDT) X-Received: by 2002:a2e:7a14:: with SMTP id v20mr10866300ljc.465.1624052467049; Fri, 18 Jun 2021 14:41:07 -0700 (PDT) MIME-Version: 1.0 References: <6caae597eb20da5ea23e53e8e64ce0c4f4d9c6d2.1623972519.git.osandov@fb.com> In-Reply-To: From: Linus Torvalds Date: Fri, 18 Jun 2021 14:40:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RESEND x3 v9 1/9] iov_iter: add copy_struct_from_iter() To: Al Viro Cc: Omar Sandoval , linux-fsdevel , linux-btrfs , Linux API , Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org On Fri, Jun 18, 2021 at 2:32 PM Al Viro wrote: > > Huh? All corner cases are already taken care of by copy_from_iter{,_full}(). > What I'm proposing is to have the size as a field in 'encoded' and > do this Hmm. Making it part of the structure does make it easier (also for the sending userspace side, that doesn't now have to create yet another iov or copy the structure or whatever). Except your code doesn't actually handle the "smaller than expected" case correctly, since by the time it even checks for that, it will possibly already have failed. So you actually had a bug there - you can't use the "xyz_full()" version and get it right. That's fixable. So I guess I'd be ok with that version. Linus