Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5775661rwd; Mon, 5 Jun 2023 08:23:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6lewgb9dDx9Axk4p/62sbE5gz1YZFJNA+ffGD3d71FkIV0GdCgS+4+Tw4LwAWn0iRtUIaG X-Received: by 2002:a17:90b:685:b0:258:7448:33c2 with SMTP id m5-20020a17090b068500b00258744833c2mr2737793pjz.14.1685978629402; Mon, 05 Jun 2023 08:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685978629; cv=pass; d=google.com; s=arc-20160816; b=LBFUAWnPdYaReYHTBUtsbGSIRPlwKtj2Ky+iSb+TYLYafnB8/2Oh7mM6kWG5Ry717+ Is8Q8pGkrDzVZ0jMNiCtR4hI3lbcf3b5fmu7BBTUTOgmb4LK08KGtFVQr3ZK5Kx8FMkH Cu0kvtu773riEAZ0vYU8ofPqukkl5x7OEZHYBXs2VtTN8uq3xDroV/UCJlHg6lMGanqB aT+jWYwa/L8BwMdkHlAUsC46UhKmUtleG1y+93is3DA0H1zS9sywTWGBYAuBKoodof3G SzTk0MpPqxoYUQ1kqXrCOgaUQiT5I2PpLVFxx8D3ddh94xGH2y8dtaqibXJ0uEal39Bq NpqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RTDcANxWM9NtJh9GqqkOSr1c39WhiteQUb6U0sjPkbw=; b=KFd7vSsrJC1Da3cpb/36Asvz4te56KufQyM5ZkGOd04r3LVp7Sp1ep9jNeX8RdSBB6 uENiIBQICnlOJHKKqCSYdxZ7AtYG8Ayj2MO1bq2drO3h/KJcqhyFysUezB4X5YIJ29Ip harrF6Qeyx/Vwk135WKMcfAe/Y0RaWOFaxSpqGwG/JfwbDCXNn+vliAxPH85+vYG4c8b YOVR2JAJ/vZJeyCHjxAFWQZVJu2w6lH3+ALSZrMRod6QWREFLFeOqFnO3j0j5Mcm7l4b mvadEJ/cjVb8LFRuRkeWfONBb+pjtS8LspEPzfpVfawv3dTvzmiMWkDru+goZhW2uTYR zqaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=C7A8ZS69; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t191-20020a6381c8000000b0053fb85dd818si5686162pgd.52.2023.06.05.08.23.37; Mon, 05 Jun 2023 08:23:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@corigine.onmicrosoft.com header.s=selector2-corigine-onmicrosoft-com header.b=C7A8ZS69; arc=pass (i=1 spf=pass spfdomain=corigine.com dkim=pass dkdomain=corigine.com dmarc=pass fromdomain=corigine.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=corigine.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234004AbjFEPTL (ORCPT + 99 others); Mon, 5 Jun 2023 11:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbjFEPTJ (ORCPT ); Mon, 5 Jun 2023 11:19:09 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2135.outbound.protection.outlook.com [40.107.92.135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB42194; Mon, 5 Jun 2023 08:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KEsWz2JM/lAvClvvKVyGVRVIxEXHLqdUxTA4F7HY0CT9o0B0WNYFKBoQYc64BF2ixi09EDm3G1wbxqvii+Px4Crx+sELLOGyi2lz9C8owTqN+VqfHiQQHpPS6wz8nQ0RGdqgyAxKAd3n3pYWqbONz9JJIiWS8CokdgSFQj3cIWvRdceTgj3oWJdM7A7E/WV3QUNC66E5hhzjzko+xn9TJ8uuskBx1uBQF3WX95qhy+CyVwZhT/fJxJQM5lLQ82dZuvDiTHYvFtn286OrUmQAIYNQv4x04iM4lX0XRTP1Z5Y3KQJGjgrGi/P8NDjtG8TgokJsrYF0xSN7DPKU7ohj0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RTDcANxWM9NtJh9GqqkOSr1c39WhiteQUb6U0sjPkbw=; b=egdcT3frvgXs04mCaZ6l2iCj28nMKw6leE4ORsG152BQDi+5FVXgLx93rRxG8DQ/CwowAUte00pdZjLA3kdLR+xHJoaIMvHJUjRHp+A69Fu/WcBR3+tDFrKZOHLICI5a4j2ILvf9pRkR3WSSu25AaOY6DffTqrnWu1Rv92lAcoiIK/vWxUGUNGBy3YVQUiqGL5wxYNgSBSt9avZJ2K92n+rYq8l9RMSiFb1XC8OGjuYPGDljObxH3wcaOG2Srzk3N7Zd5qC5UyP7jWbvL+We+lALOHcB8DlnDMzqOrVrXF/8GK0VLlgWrlQEGhL8V9KFMBMNyyEA0QRuS93BWZAxAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RTDcANxWM9NtJh9GqqkOSr1c39WhiteQUb6U0sjPkbw=; b=C7A8ZS69Vr+L9qI9X2G/tdtUGYLZOaf/AF5JEfjREcUlBeiVsUbAeM9h/4q6yEDUvhYu70gRQrUOe19MrzdUIcordxOPGw04F6YgMbKlcVySitBzbunVpSOsoLn/WeIRFX0JvNNt3xKax4EAkoEhkX6+/cjkeqqDNH+Zs9dAyF8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) by LV3PR13MB6478.namprd13.prod.outlook.com (2603:10b6:408:197::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.18; Mon, 5 Jun 2023 15:19:05 +0000 Received: from PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::5e55:9a39:751f:55f6]) by PH0PR13MB4842.namprd13.prod.outlook.com ([fe80::5e55:9a39:751f:55f6%3]) with mapi id 15.20.6455.030; Mon, 5 Jun 2023 15:19:05 +0000 Date: Mon, 5 Jun 2023 17:18:59 +0200 From: Simon Horman To: David Howells Cc: netdev@vger.kernel.org, Linus Torvalds , Chuck Lever , Boris Pismenny , John Fastabend , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Willem de Bruijn , David Ahern , Matthew Wilcox , Jens Axboe , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v4 03/11] splice, net: Use sendmsg(MSG_SPLICE_PAGES) rather than ->sendpage() Message-ID: References: <20230605124600.1722160-1-dhowells@redhat.com> <20230605124600.1722160-4-dhowells@redhat.com> <1729074.1685977857@warthog.procyon.org.uk> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1729074.1685977857@warthog.procyon.org.uk> X-ClientProxiedBy: AM3PR07CA0072.eurprd07.prod.outlook.com (2603:10a6:207:4::30) To PH0PR13MB4842.namprd13.prod.outlook.com (2603:10b6:510:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR13MB4842:EE_|LV3PR13MB6478:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b43b6b5-7ff7-401c-1d42-08db65d8336a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6P9ErAhwgywzK3rW87+9bEVeYU34AHtpVvJ3PkMjq7OU+1f2m4P3Xh8IMhgsLG/1u1uqDjiolsT9NAEKJcKDkaMVq1LWAH758Wb0qSf1Bl9Mb/ldgKCB7+m1zztkm/stHLPdoBZqRVH/fltweSkbdlc7T7IfBn10FYD8kLBORdbVQWyPVlCjcgDUr2P/3hh3PPaoDE+tPLdD7vvsAFOBCci2kPoI5xo+CsrraarNHvKkOx92x9st5IayKl6B5EbQ+KF49tl8Rg5ce7egmP53KYcIWnrOexF4FczDEGZVGU+b4Px5CTNJpxx7OTIGowhrszvrxron7k2pnKJ7KinArDB5YV2UcTQhtbLyM1vzTOEus/y44PPdKXgOYJvbFkYujaRe8981+i1XGJ1oDlzbMlUkWtk58qL7dIDoAD9Gi4tUvCmlayftC5Hdtuvwj/YrxrQ+ZnnKnGoTy/PrM89XlcItcP1SqqVpNNGv3oZCpVw2nz2yHiJTrzMjxF+oDuPjXGZBlEE2pqRjAzrxzjzGYYH/e6bvl1vSrvgssjeJ86rnreOQ/mNHa0zNzRopWQQhoT1FkZJDuE2eI8xNGETatIZBGEfH173fTFVyIZM1ZTA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR13MB4842.namprd13.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(39840400004)(136003)(366004)(346002)(451199021)(44832011)(7416002)(8676002)(8936002)(5660300002)(4744005)(2906002)(316002)(66476007)(66556008)(66946007)(6916009)(4326008)(41300700001)(6486002)(54906003)(6666004)(6506007)(6512007)(186003)(36756003)(2616005)(83380400001)(478600001)(38100700002)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QzdOA6rrNDsgry81dhE6XZmalw39UX55k6YfpWHheS2fLOzAzmzgC58hWEuk?= =?us-ascii?Q?IlxTyd2MVN7HFLjniUFIQWp8ZKuQ9XcHHdGkj2II4JX2icKsslQT+4GdoeTs?= =?us-ascii?Q?lv5JCLdpbs+U0s7YCzBanzqdjiTkZEA1HY3ollAxGRJWzFJagTOu4AI4b9Xl?= =?us-ascii?Q?fUv9NNk+hkjFNA2y8jvwzpSLdmcfJjqILwW0zqZMT0pDYNEvSU0o6G34Z1HS?= =?us-ascii?Q?xAqnQSELOhKbmlX7evRkScwE7Z6ep3CwIaST1XjZ6DK5k2J4vTb6lyeDt7sW?= =?us-ascii?Q?9qMYYggljF4FP838Q/W/oLQPoLwe/iLt5689KkK6Yae88oDJefqav/6jywCs?= =?us-ascii?Q?k+RNP9UEfl49p9fXSnc+XekyQybz6yFgbX8sNqCj06WlBLqDhKoGY7SVenam?= =?us-ascii?Q?RcNNahwy/Ih1xGdP9zxuc1WcvNYq2DtMvIM/oIv+XyIhxZPXv5sh2pPUnDz+?= =?us-ascii?Q?1GGSCDIG9LzHNKU3CJOSjzBuIX+aHBi9DaLxXUB1hJPiRvEOGu0IWJVjSoZR?= =?us-ascii?Q?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07o7qX2uIclmDJ9K?= =?us-ascii?Q?FNru8i59okL5rBih8MktYjg8aoDykraRMut9Je7OX7XAx6YEgvgr3zyjRUya?= =?us-ascii?Q?SUHolx8SfUICT1QjX5lCD9uqy9N7G0N1u0D28mNGfEDYm2ke2yNqzaDM2C/Y?= =?us-ascii?Q?1CxNo8EhuV4FmIUQpPcMqE23/R8Y3CazwfSVHcuaKvc7r5OE4LnA9lDGQdm6?= =?us-ascii?Q?22uzEm3MznICxzyVtRm3cgkKT/Q9IdxoF28HxsMa+JBwm/JpnmiCvGnaNVVb?= =?us-ascii?Q?09a7tA=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b43b6b5-7ff7-401c-1d42-08db65d8336a X-MS-Exchange-CrossTenant-AuthSource: PH0PR13MB4842.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2023 15:19:05.4070 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LXRiEdmSSxdDDDTHjfq+PRWuejWGvP9+dIj8D7JeLUAZG8Z5T0NbJlGKUVfLOSI+fH/jiQKpTLedsyETuI2pXgX+LUuFQOL4Mm1ET/NF8oc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR13MB6478 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 05, 2023 at 04:10:57PM +0100, David Howells wrote: > Simon Horman wrote: > > > I'm assuming the answer is that this cannot occur, > > but I thought I should mention this anyway. > > > > If the initial value of len is 0 (or less). > > ... > > > + return spliced ?: ret; > > > > Then ret will be used uninitialised here. > > len shouldn't be <0 as it's size_t. Yes, sorry for not noticing that. > I don't think it should be possible to get there with len==0 - at least from > userspace. sys_splice() returns immediately and sys_sendfile() either splices > to a pipe or goes via splice_direct_to_actor() will just drop straight out. > But there are kernel users - nfsd for example - but I don't know if they would > splice directly to a socket. > > That said, it's probably worth preclearing ret just to be sure. Thanks, I agree it's better to be safe than sorry.