Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2746968pxb; Tue, 19 Jan 2021 05:16:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzh7zjx1K8e9X/gu8JOICd0gsB8Jy1ed2hfAShFUyiz9VANj/ahZ74lgnY8doxFvSWQVzE X-Received: by 2002:a17:906:30d3:: with SMTP id b19mr2853231ejb.538.1611062211551; Tue, 19 Jan 2021 05:16:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611062211; cv=none; d=google.com; s=arc-20160816; b=CyjrlsRVr8RdFTMHzUVfP8D28E+NH0HSfkeR2AAHin52JRotS1sFsEdFLQIgiwUbto 5qaSGr1H7wUJZdV6c09X9jA4DGOv3yYtz2/L67gpFRUZpF4fCTix/d+d5eQrZnrqbAx5 DXAsXGn5ZPefrNQcqGGph38Pfz1zlda7Fq9DfHtJB9uV4Us9xCgsZwo217fwJyvq5wPr /b4IpI4mkKjU485bBpcdXkDGCOu+hPovQwE+jH7emx67Qg+AxvmzWRfgfK7mTj+svuFg vJOl0757XHw7wiLhrDEX5G6oJM1kDky9KpBfxnaEE65ZdIbpf48jmTajBChzAJXXXs1N 3o1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=B3Cy0Hm6xTRsmff/JkHOzD1P8m+ZaMSZbwZ78cwq0GQ=; b=mG1j7kMNBzQCwekMyEOuEeYLP8vJ4gMxY3C6ZuzjaDBUpIApSfhtabeUD2zyJLHaoM RXrq3/bEGwPWAARtQydMoetp6FqhUhxsXe5EsEj/idB34Q7Xe+4iIjBQvnrnG3F8tFJF LMvWypv1ClD4GxisRiQzUeHMj49ZHZkroOZy8FF+w+LkYWrmmTaWaHFcJ6CalRGADlDK HwPjVvibk+2Y+U5cRvK5kpxBiEt852YJpKq7PzI+oYFkrfhSxCUAXGuG44asV7YYQJWI AlmgZSDPrPuav+jyRS/tm8yoTDGG5SPP9s6YpDxeClkDnmumDfdUCA0AV0PicFBmrzyh Uodw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ZGSI5bxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si8349737edz.497.2021.01.19.05.15.43; Tue, 19 Jan 2021 05:16:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=ZGSI5bxW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390417AbhASNF2 (ORCPT + 99 others); Tue, 19 Jan 2021 08:05:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393639AbhASNA4 (ORCPT ); Tue, 19 Jan 2021 08:00:56 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EAA9C06179C for ; Tue, 19 Jan 2021 04:59:07 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id h19so13499898qtq.13 for ; Tue, 19 Jan 2021 04:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=B3Cy0Hm6xTRsmff/JkHOzD1P8m+ZaMSZbwZ78cwq0GQ=; b=ZGSI5bxWjU+x6vpwy6aJhb0H6QN8FxL1hxmj/KVTU1+omQptO3f8ci9LDt5IMdmEm1 c4v/0lgymC7G0E3l+2BOtcBk1DueLIbZR8J5cxMMLK3Yi0npvu/r/IIOp2wnIuuEiMOE DrJjzANZhdQ53CfuySR1LOimnUnSIDo4FGY/QmSEA0+i1UEodaNTu5jJ1/O7oInHnfdm qtOg4X7Kif7h5aJ2gi3ToQZLQMqsAQcD3DKwsenq41fiLGO26hoqLlrhFHOsM+1Ha+/8 g1zHKQfTf/f2IFzFEdXrbT2v96nn6w01sjb/AslAOhGMjo1PLV9/0FdTcZ/CTpaHjkXR P6zQ== 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; bh=B3Cy0Hm6xTRsmff/JkHOzD1P8m+ZaMSZbwZ78cwq0GQ=; b=fAUVuVrLfExwlKx5U7UlbhQLN6iHeKPKyuul84YL61L2+IbDu5VCPEhMsO1un5c78l dHXTEYvOPlNbV+DBnp77DZfCMrub60UEOxYNH7uDhSU28U+I/i9Gkjsx/wLIufBUQHtN hd0d4jEOC1xZ/Q2nJPYytruCiR6sUvs3bRelMC2QxNcqr6sV0eB/pgAG+1x8FmeuDa68 36nmhoLgbirHsUWHvFiiftvB/hwRbMUXkZSI+vfb04a5ZGnflq0tneln6i7D6fIy7mUB MnaDpu16bSAS1Z42pZedTEHD5S7PLKeK4drz4r9OianNJ/bID+NZoohaOYh2hbTTSYkx odBA== X-Gm-Message-State: AOAM532CmsrNwMTq0e0UechrVm/joIibJT1QPMz8Iv2f0G1bzwIh8UpW xc2gNNBEEb7/b2w0nghm3cdk5A== X-Received: by 2002:a05:622a:4d1:: with SMTP id q17mr4030813qtx.272.1611061145938; Tue, 19 Jan 2021 04:59:05 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id k64sm13021228qkc.110.2021.01.19.04.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 04:59:05 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l1qbA-003bfs-PA; Tue, 19 Jan 2021 08:59:04 -0400 Date: Tue, 19 Jan 2021 08:59:04 -0400 From: Jason Gunthorpe To: Douglas Gilbert Cc: Bodo Stroesser , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, target-devel@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, martin.petersen@oracle.com, jejb@linux.vnet.ibm.com, ddiss@suse.de, bvanassche@acm.org Subject: Re: [PATCH v6 1/4] sgl_alloc_order: remove 4 GiB limit, sgl_free() warning Message-ID: <20210119125904.GR4605@ziepe.ca> References: <20210118163006.61659-1-dgilbert@interlog.com> <20210118163006.61659-2-dgilbert@interlog.com> <20210118182854.GJ4605@ziepe.ca> <59707b66-0b6c-b397-82fe-5ad6a6f99ba1@interlog.com> <20210118202431.GO4605@ziepe.ca> <7f443666-b210-6f99-7b50-6c26d87fa7ca@gmail.com> <20210118234818.GP4605@ziepe.ca> <770a562e-52b9-ba93-59d3-1026340bf4f3@interlog.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <770a562e-52b9-ba93-59d3-1026340bf4f3@interlog.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2021 at 08:27:09PM -0500, Douglas Gilbert wrote: > To protect against the "unsigned long long" length being too big why > not pick a large power of two and if someone can justify a larger > value, they can send a patch. > > if (length > 64ULL * 1024 * 1024 * 1024) > return NULL; That is not how we protect against arithemetic overflows in the kernel Jason