Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp409263ybb; Wed, 25 Mar 2020 02:09:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtuK1u5Mp9PpSYpI5WrHDYV2IXbXnbVQNq5Lh2/9iSUbs6MEn1pUc/i0b3w8Fg76QnMjyss X-Received: by 2002:aca:f4d0:: with SMTP id s199mr1785524oih.109.1585127396756; Wed, 25 Mar 2020 02:09:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585127396; cv=none; d=google.com; s=arc-20160816; b=JM/ZPQxAsIWDU4m4zxHXIBBYduVRkqFWDBfN2j7xhn7gxgEMl0ux4djgwJLKJMLQRI 7lcdUKQsAi6gsHWTlvViSaN0WWa9NP+AxSsPTF022kBWyT/5AZ+GuFMyEBUn7cWgzXt8 q82h7AuvkBO+gD31xN5o/PYZkrq0f5q24aWw/rPubhFSBKr3nZvrLn9L+q/nPiTjWvuj fM+WrTLtTP0IT1JaSx8onqQV7VcDLn2DcGfF9gwtDqaaj3BAyROcm7Vr8FZtjirL6hcv mUf+l2idPryLmS1bU0opbxtIWlimQJeN8tek8LhJe/0c2bOffinlBgfE3OqEtunyj76O FOaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=afugKYwAFd8RIjB02GefkanDSF4I40fGZACjXYFZuvM=; b=hxCC6NdiVVNsZhzWrsPVhcSy7U0MvO/788wauJ6SSNyNuXHmDDdRiK/HXSLUDUaXqX 21L+YcY2aeM1lFGd4NmVDqkRgJ6GtjWox8bN7gfgGNP6uUJKrmScDcOCY8bGz2HKBBx3 lbSTxKLKNTQiaHYBHsQFzUbB9391bAeAdgs8Rr5LiNYvZyL/rXkXil2AISJdaNho/bdK mnLN4bqewy2Tq5DVc3G5xOp1tiXZy6z6I01BB4ysy9Whl/5r3rT2+xzEFpn5O+hK70vN czxCaknm9VqDz5PVLL7vPlOJPSQkm29ZAip5gQdf4jplNUa2+WwRhivwxXfzUSFE60yP pUeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N8A3l0X0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q25si5982216otn.323.2020.03.25.02.09.42; Wed, 25 Mar 2020 02:09:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N8A3l0X0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727451AbgCYJIl (ORCPT + 99 others); Wed, 25 Mar 2020 05:08:41 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42096 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726043AbgCYJIk (ORCPT ); Wed, 25 Mar 2020 05:08:40 -0400 Received: by mail-wr1-f67.google.com with SMTP id h15so1861741wrx.9 for ; Wed, 25 Mar 2020 02:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=afugKYwAFd8RIjB02GefkanDSF4I40fGZACjXYFZuvM=; b=N8A3l0X0NYWYEhPlpQP/+iv/Y0Vene5U0OT2pZ8Y592F4PnmV4TPrBAuYTOXyW3w9O Sj2pD3Y+E4dN/71GlxXT7Ox4C9O9sX9HH8r4UKCPHefbeDz36/ll05FmBYWWvVZoNVYT 65DCrSfJ7Sx7eyCbjn4yjhQw0oAV1htzqwj8a3HkWKlKN8bOSBsWacfeQ+I16Spf5tkY osgCMfOmu12YOlvPORg7J05FsbvWfBmny5xh1zfZeY7qF3UphPwQEA5PutNn19NfAMkX TusJn2c4GDwDF8VPgo2ZSqwJMWV6Mm2Mqk/zGFPSZ5RhwwtK4PLuieU9q2fW8jkG9+0L ugGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=afugKYwAFd8RIjB02GefkanDSF4I40fGZACjXYFZuvM=; b=gVmr8gRjpmxp4Gp49DRbiQ9TZr6GZrXqWtGWy09cOPna7ZJ99+beE/lD+88ItwBAV4 Euh/kz+aoRVlcTZw5SHh2ACgb8VgRoC6p4JAWDhnYX0HF5kxXALqt1+L0rRhQaRcZYIg t6au6yAhYq9sisATllHW+ejbqpntQYEbs4ZIPEVdmV8dSIS0OHMJy8nmd68ywsgbOdbB OG2mZ6pU/QINuvjT+lPAeFxU6/9j4cFLhAxeBTtblGOlqc3f4Z0adpagEUkW7FSjkYtK wIpCeE6E1+MjvPxwriDC31yB7OYp04qsGgdC9NdiBLXaR1Dk02OyY5a3mlN3lr+yaUx9 AfrA== X-Gm-Message-State: ANhLgQ2SXnEOASOv6jz2bqVatvboQ0ZMjBo86EdUZoATPJ1y/MElCxJm Zbw+B2NbVoTKMg6z6955Qt0= X-Received: by 2002:adf:ce0d:: with SMTP id p13mr2269121wrn.8.1585127319134; Wed, 25 Mar 2020 02:08:39 -0700 (PDT) Received: from wasp.lan (250.128.208.46.dyn.plus.net. [46.208.128.250]) by smtp.googlemail.com with ESMTPSA id 127sm8565048wmd.38.2020.03.25.02.08.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 02:08:38 -0700 (PDT) From: Shane Francis To: dri-devel@lists.freedesktop.org Cc: amd-gfx-request@lists.freedesktop.org, linux-kernel@vger.kernel.org, bigbeeshane@gmail.com, alexander.deucher@amd.com, christian.koenig@amd.com, mripard@kernel.org, airlied@linux.ie, David1.Zhou@amd.com Subject: [PATCH v4 1/3] drm/prime: use dma length macro when mapping sg Date: Wed, 25 Mar 2020 09:07:39 +0000 Message-Id: <20200325090741.21957-2-bigbeeshane@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200325090741.21957-1-bigbeeshane@gmail.com> References: <20200325090741.21957-1-bigbeeshane@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As dma_map_sg can reorganize scatter-gather lists in a way that can cause some later segments to be empty we should always use the sg_dma_len macro to fetch the actual length. This could now be 0 and not need to be mapped to a page or address array Signed-off-by: Shane Francis --- drivers/gpu/drm/drm_prime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 86d9b0e45c8c..1de2cde2277c 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -967,7 +967,7 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, index = 0; for_each_sg(sgt->sgl, sg, sgt->nents, count) { - len = sg->length; + len = sg_dma_len(sg); page = sg_page(sg); addr = sg_dma_address(sg); -- 2.26.0