From nobody Mon Jun 8 07:24:43 2026 Received: from outbound.baidu.com (mx22.baidu.com [220.181.50.185]) by smtp.subspace.kernel.org (Postfix) with SMTP id A5A5D47CC7A for ; Wed, 3 Jun 2026 12:37:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.181.50.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780490257; cv=none; b=ByKD+KOdDf5RHsurH99oGbwvVG18kv72b2RmA7cUqlfMOPaWcJLsvHt7FWnvGCecv1aOCdFQEIb27h0lRToSj5h7dcT/+t6TY+5wg7YlPFfdcrgreGbmFSUoaWRUDdIuG349dXO11p2b3uYaWA0edEdhTMB4ILn5TSyPOLJc5lI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780490257; c=relaxed/simple; bh=0k5kDVvurdS1UKmVo+ocFhWYYqixsfFXZJP3H1tHw+E=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=nZ/nSKAiUKrLLZm9p+661q5HIhah3bKvkgXw/1kD6TEy0bgTOUIXghZZuaPKNmFXAH/RldKRfvpiYz/oDXopk1Yu93bIhL3/yf4IkcVDGFs2tdaosC+BMahXYQGwjzFYTjs1B+n6/gGxO6IOO4z8zHn8m6/05cjistvfUYH+cvk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com; spf=pass smtp.mailfrom=baidu.com; dkim=pass (2048-bit key) header.d=baidu.com header.i=@baidu.com header.b=Rc+LXHE3; arc=none smtp.client-ip=220.181.50.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=baidu.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baidu.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baidu.com header.i=@baidu.com header.b="Rc+LXHE3" X-MD-Sfrom: lirongqing@baidu.com X-MD-SrcIP: 172.31.50.47 From: lirongqing To: Marek Szyprowski , Robin Murphy , , CC: Li RongQing Subject: [PATCH] dma-debug: fix physical address retrieval in debug_dma_sync_sg_for_device Date: Wed, 3 Jun 2026 20:37:08 +0800 Message-ID: <20260603123708.1665-1-lirongqing@baidu.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: bjkjy-exc7.internal.baidu.com (172.31.50.51) To bjkjy-exc3.internal.baidu.com (172.31.50.47) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baidu.com; s=selector1; t=1780490241; bh=/QlEyzqlrCJcbiK9131mSLXFyLatpetDI9hu0ko7ZMM=; h=From:To:CC:Subject:Date:Message-ID:Content-Type; b=Rc+LXHE3JKL+VkErKY1D/0EJnt0Etz4TAPQSnje5o4bmrl2mhZuTa3Q97GxsYgdkl 3EWStgg9NYJ83KAS1rP+cWqN7i91eYyWKvc+Bp8YXES6Q46tjkt4oOPJbfxBZuTuDV bDnWZvOD4vL0g65C07GPUH1qKijbQvdxg4r0KSGO2YtSso9HS6rKraF9kcLMOSgFJ9 U9l5v8EZivm+pX1IPG3WG6bR2ZIUSdVndRPRDfIBoUU8m5IhFAl2hlN+DkFY1qmobT Ut8CtYTnax4AMk+LqWUJcXl0s+AQ23U7ihhlnaZCdgzTEet84WBgXbczeqWs4v/b4s GZa5O/VjRyKtg== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li RongQing In debug_dma_sync_sg_for_device(), when iterating over a scatterlist, the debug entry population mistakenly uses the head of the scatterlist 'sg' to fetch the physical address via sg_phys(), instead of using the current iterator variable 's'. This causes dma-debug to track the physical address of the very first scatterlist entry for all subsequent entries in the list. Fix this by passing the correct loop iterator 's' to sg_phys() Fixes: 9d4f645a1fd49ee ("dma-debug: store a phys_addr_t in struct dma_debug= _entry") Signed-off-by: Li RongQing --- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index 3248f8b..2c0e2cd 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -1556,7 +1556,7 @@ void debug_dma_sync_sg_for_device(struct device *dev,= struct scatterlist *sg, struct dma_debug_entry ref =3D { .type =3D dma_debug_sg, .dev =3D dev, - .paddr =3D sg_phys(sg), + .paddr =3D sg_phys(s), .dev_addr =3D sg_dma_address(s), .size =3D sg_dma_len(s), .direction =3D direction, --=20 2.9.4