Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934622AbYCFOOl (ORCPT ); Thu, 6 Mar 2008 09:14:41 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1761810AbYCFOO1 (ORCPT ); Thu, 6 Mar 2008 09:14:27 -0500 Received: from courier.cs.helsinki.fi ([128.214.9.1]:47170 "EHLO mail.cs.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753629AbYCFOOZ (ORCPT ); Thu, 6 Mar 2008 09:14:25 -0500 Date: Thu, 6 Mar 2008 16:14:23 +0200 (EET) From: Pekka J Enberg To: Patrick McHardy cc: Netfilter Development Mailinglist , clameter@sgi.com, joe@perches.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Netfilter Development Mailinglist Subject: Re: [PATCH] netfilter: replace horrible hack with ksize() In-Reply-To: <47CFF9B7.5060803@trash.net> Message-ID: References: <47CFF9B7.5060803@trash.net> 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 Content-Length: 917 Lines: 30 Hi Patrick, On Thu, 6 Mar 2008, Patrick McHardy wrote: > > @@ -95,7 +85,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct > > newlen = newoff + t->len; > > rcu_read_unlock(); > > > > - if (newlen >= ct->ext->real_len) { > > + if (newlen >= ksize(ct->ext)) { > > This needs to look at the currently allocated size, otherwise > it will always realloc when adding new extensions after having > used up ksize(ct->ext) space. Lets say you p = kmalloc(8, ...); Then ksize(p) will return the currently allocated size which is 32 bytes when page size is 4 KB, and not 8 bytes. So it should be equivalent of what the current code does. What am I missing here? Pekka -- 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/