From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756139AbbIYMQu (ORCPT ); Fri, 25 Sep 2015 08:16:50 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:41074 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755578AbbIYMP6 (ORCPT ); Fri, 25 Sep 2015 08:15:58 -0400 From: Robin Murphy To: akpm@linux-foundation.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, m.szyprowski@samsung.com, sumit.semwal@linaro.org, sakari.ailus@iki.fi, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/4] dma-debug: Check nents in dma_sync_sg* Date: Fri, 25 Sep 2015 13:15:45 +0100 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-OriginalArrivalTime: 25 Sep 2015 12:15:54.0178 (UTC) FILETIME=[ECF5A220:01D0F78B] X-MC-Unique: Vc46TDxiRiu4tGzrbm_46g-7 Content-Type: text/plain; charset=WINDOWS-1252 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id t8PCH3jS029258 Like dma_unmap_sg, dma_sync_sg* should be called with the original number of entries passed to dma_map_sg, so do the same check in the sync path as we do in the unmap path. Signed-off-by: Robin Murphy --- lib/dma-debug.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/dma-debug.c b/lib/dma-debug.c index dace71f..908fb35 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c @@ -1249,6 +1249,14 @@ static void check_sync(struct device *dev, dir2name[entry->direction], dir2name[ref->direction]); + if (ref->sg_call_ents && ref->type == dma_debug_sg && + ref->sg_call_ents != entry->sg_call_ents) { + err_printk(ref->dev, entry, "DMA-API: device driver syncs " + "DMA sg list with different entry count " + "[map count=%d] [sync count=%d]\n", + entry->sg_call_ents, ref->sg_call_ents); + } + out: put_hash_bucket(bucket, &flags); } -- 1.9.1