Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946083AbWBCXNs (ORCPT ); Fri, 3 Feb 2006 18:13:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1946082AbWBCXNr (ORCPT ); Fri, 3 Feb 2006 18:13:47 -0500 Received: from sj-iport-3-in.cisco.com ([171.71.176.72]:53384 "EHLO sj-iport-3.cisco.com") by vger.kernel.org with ESMTP id S1946080AbWBCXNq (ORCPT ); Fri, 3 Feb 2006 18:13:46 -0500 X-IronPort-AV: i="4.02,86,1139212800"; d="scan'208"; a="400560572:sNHT32150280" To: Hugh Dickins Cc: Andrew Morton , "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] ib: don't doublefree pages from scatterlist X-Message-Flag: Warning: May contain useful information References: <20060104172727.GA320@tau.solarneutrino.net> <20060105201249.GB1795@tau.solarneutrino.net> <20060109033149.GC283@tau.solarneutrino.net> <20060109185350.GG283@tau.solarneutrino.net> <20060118001252.GB821@tau.solarneutrino.net> From: Roland Dreier Date: Fri, 03 Feb 2006 15:13:43 -0800 In-Reply-To: (Hugh Dickins's message of "Fri, 3 Feb 2006 19:51:18 +0000 (GMT)") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (Jumbo Shrimp, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-OriginalArrivalTime: 03 Feb 2006 23:13:44.0597 (UTC) FILETIME=[7AAFDC50:01C62917] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1276 Lines: 30 Thanks, Hugh. This is definitely a real bug caused by an embarassing oversight on my part. I will test and apply to my trees. > Warning: untested! And please double-check the adjusted definition of > IB_UMEM_MAX_PAGE_CHUNK - the old definition was avoiding "sizeof"s, but > I don't understand why. The old definition of IB_UMEM_MAX_PAGE_CHUNK came from my paranoia: > #define IB_UMEM_MAX_PAGE_CHUNK \ > ((PAGE_SIZE - offsetof(struct ib_umem_chunk, page_list)) / \ > - ((void *) &((struct ib_umem_chunk *) 0)->page_list[1] - \ > - (void *) &((struct ib_umem_chunk *) 0)->page_list[0])) > + (sizeof(struct scatterlist) + sizeof(struct page *))) I was afraid that some compiler somewhere might add in some padding that would cause sizeof (struct scatterlist) to be smaller than the entries in the array end up being, but now I've convinced myself that this can't happen -- if it could then things like ARRAY_SIZE() would be stuffed as well. So I think your version is correct and clearer. Thanks, Roland - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/