Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7284642rwl; Mon, 9 Jan 2023 21:35:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXsNS0Ne0lDl0nvwVvg6vWkrYRVYGwaCI0kP0J+0Ca8vJJsKmIf7aRx+S70F2exPwZDcJ6NN X-Received: by 2002:a17:907:c011:b0:7c0:e5ca:411c with SMTP id ss17-20020a170907c01100b007c0e5ca411cmr55362124ejc.17.1673328946375; Mon, 09 Jan 2023 21:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673328946; cv=none; d=google.com; s=arc-20160816; b=MTlTEekY6NBYneqRMF/B0cAhmt/qKmnX61ktW40ZVrT8hlveZL9rZ1AG0fZYZ6UxH4 Jsyv29XSFAsjVJ5CLx3WFBMEQ7xMhmT2R04uW8sHq4uENew+88vR1hJTQhPav6SD2OkI 9+sSMMXvt9A4C+OhRrc2SnnJ6n98wwH/5c+83tIoWXctTDFQ8WtR2BEqLYzN8AZo9Yl5 i/Ey/wALMDMdTg6wcYbe+EQN2AtxQFIWCcP6F3L1aeYsDIFrPOEh903W1mlSK2gPwNvs 57TPU2JSaEDJPeo49Fz7Dzb/uFzOr0MWsEwy9YebF8JClNg5Cu5AwSuJqtDYpwEtZ4OF s75w== 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=s3eeXxhx4tpS7pmZqfCJKqLGMlzmrOgdka1kjKMznI4=; b=sWtQvZO4b8riWTJ7uQmi3h5HJSTXDXoPnGxIJ6+YR/ijlKUs8ti6Ehs/UOodnD3UZv bNgOO30EM8c+q5LkZ1rcikaSozLMlEOpJZav3EPJjfcaq1EgEYrLjify+wX2PBI/BF0H TFXnpPiUZ8hWS8cbnPzbjPrvQDMnKGt+Tnu5dBLDtFS62rWv4/kENcZreBwb0L0Nd4Qh PiqdOHHIxlO5Dc2G/ymrglCeJY15EmqXhDgCxuwRJRsKLgAr1SBAVCpSiEVdqQGimpye r4xumE1wsu0TSAiLNfSUadoUvD+zivjgSPvr1/U8xLaQg5pQfYGmcp7ohhciCq5u51AV owWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=XGJEFCmW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cf20-20020a170906b2d400b007c090dba7bcsi8349149ejb.210.2023.01.09.21.35.31; Mon, 09 Jan 2023 21:35:46 -0800 (PST) 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=@infradead.org header.s=casper.20170209 header.b=XGJEFCmW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbjAJFIi (ORCPT + 55 others); Tue, 10 Jan 2023 00:08:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjAJFIV (ORCPT ); Tue, 10 Jan 2023 00:08:21 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 175F01CFD4; Mon, 9 Jan 2023 21:08:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=s3eeXxhx4tpS7pmZqfCJKqLGMlzmrOgdka1kjKMznI4=; b=XGJEFCmW/g7ojPqXxDzSIo/bZf 2a1smaf/JQQz3olueaj9Y/Wc9QEAHCtgcy/b088rjTbOT7NQvB4EWdhUDrvh4EYj9IicLMmUDh6vF 3eMwCkdKa3Sa+CQyan10aMktrXtIQ7GNYZ+mSs2eNJcC1xWRHZk5YgJJYlST66qQAoRpxqTROL8T4 T232bsST3sdD/CpGNKEQBwDYVhkPgZSp0qRqj4Srl4tvHyDk0aiaaaw47+4+cCxG1s5iLl59Km8fF EHw2/n22dBHQXzTjC6VfjYdPM3tnT5jcbbCsn50bm0zeldFCJaFDuJAFwM1mv61F6FP5s0EHEoIWN ZRBIX7bQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pF6s5-002w7R-Jj; Tue, 10 Jan 2023 05:08:25 +0000 Date: Tue, 10 Jan 2023 05:08:25 +0000 From: Matthew Wilcox To: Yishai Hadas Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, jgg@nvidia.com, axboe@kernel.dk, logang@deltatee.com, hch@lst.de, alex.williamson@redhat.com, leonro@nvidia.com, maorg@nvidia.com Subject: Re: [PATCH] lib/scatterlist: Fix to calculate the last_pg properly Message-ID: References: <20230109144701.83021-1-yishaih@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230109144701.83021-1-yishaih@nvidia.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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, Jan 09, 2023 at 04:47:01PM +0200, Yishai Hadas wrote: > if (sgt_append->prv) { > + unsigned long paddr = > + (page_to_pfn(sg_page(sgt_append->prv)) * PAGE_SIZE + 1. page_to_pfn() * PAGE_SIZE is spelled page_to_phys() 2. physical addresses have type phys_addr_t. Oh, wait, paddr isn't a physical address, it's a pfn because you divide by PAGE_SIZE at the end. But you will get truncation on 32-bit, because page_to_pfn() has type unsigned long. Anyway, this shouldn't be called paddr. Maybe last_pfn or something? > + sgt_append->prv->offset + sgt_append->prv->length) / > + PAGE_SIZE;