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 B1570C48BDF for ; Fri, 18 Jun 2021 21:41:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B62F6100B for ; Fri, 18 Jun 2021 21:41:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbhFRVnU (ORCPT ); Fri, 18 Jun 2021 17:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbhFRVnT (ORCPT ); Fri, 18 Jun 2021 17:43:19 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C79B6C061574 for ; Fri, 18 Jun 2021 14:41:09 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id r16so15862915ljk.9 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=YORvmSoeSipBXyBIucQJeNSs0Q50XTsKU0D5SAl3/EsAIWRESaV94TopUZYgL+Jr8u GIJUZn9qODEnUanMAIrznAJM4+cgoKqDbwQ8u8FMlZDkUfgkjypZgTAnfxKh4l+7I0iV v70xlb4/dhV6PGFERfEaDkx9lX9Q4TJsgrlb0KwZjHbdAovz6/iyRKekW9FUdp1rSL7y KVs68B6WMj2PCz1mPdRQil9+lw/8Hh1UfVefuuuLjlwWIwZAJIVmDsPsTDecqMdvWPv5 qs2oLp2q4IwjZXykWBAis11fwodfQU1yyG1zQUH3khQ+ZrQ3q9SgMCzrZjWMKdUB/bxD HSew== X-Gm-Message-State: AOAM533FFDOHC6/3OH1YqsrUpyVRQ/sNu0kVrPoQ7Fsu7QMfXJwQ5Vvx sKOhRi2jqNk2c+iiJkKPmCw+PNglFOy8jN2P X-Google-Smtp-Source: ABdhPJyb5HiwVThYCy/cDCLqiJlnNvX6VM+ecsPhYetM+HXyImR/P9zB4SwauFnvr2TFcYgX8RPVFg== X-Received: by 2002:a2e:9b10:: with SMTP id u16mr10962546lji.167.1624052467803; Fri, 18 Jun 2021 14:41:07 -0700 (PDT) Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com. [209.85.208.177]) by smtp.gmail.com with ESMTPSA id v21sm230701lfr.192.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-f177.google.com with SMTP id k8so15764979lja.4 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-fsdevel@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