From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751069AbbCSWJG (ORCPT ); Thu, 19 Mar 2015 18:09:06 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58364 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbbCSWJD (ORCPT ); Thu, 19 Mar 2015 18:09:03 -0400 Date: Thu, 19 Mar 2015 15:09:01 -0700 From: Andrew Morton To: Sebastian Ott Cc: linux-kernel@vger.kernel.org, Florian Fainelli , Horia Geanta , Jiri Kosina Subject: Re: [PATCH] lib/dma-debug: fix bucket_find_contain Message-Id: <20150319150901.a004c3dc15a49a1859e467ff@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Mar 2015 19:24:29 +0100 (CET) Sebastian Ott wrote: > bucket_find_contain will search the bucket list for a dma_debug_entry. When > the entry isn't found it needs to search other buckets too, since only the > start address of a dma range is hashed (which might be in a different bucket). > > A copy of the dma_debug_entry is used to get the previous hash bucket but when > its list is searched the original dma_debug_entry is to be used not its > modified copy. > > This fixes false "device driver tries to sync DMA memory it has not allocated" > warnings. The changelog doesn't help me understand how serious this is. A 4.0 thing? -stable? > --- a/lib/dma-debug.c > +++ b/lib/dma-debug.c > @@ -361,7 +361,7 @@ static struct dma_debug_entry *bucket_fi > unsigned int range = 0; > > while (range <= max_range) { > - entry = __hash_bucket_find(*bucket, &index, containing_match); > + entry = __hash_bucket_find(*bucket, ref, containing_match); > > if (entry) > return entry; This code just got more confusing :( Are you sure we aren't supposed to use `ref' in bucket_find_contain()'s call to get_hash_bucket()?