Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750755AbVKQKxT (ORCPT ); Thu, 17 Nov 2005 05:53:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750756AbVKQKxT (ORCPT ); Thu, 17 Nov 2005 05:53:19 -0500 Received: from aun.it.uu.se ([130.238.12.36]:56212 "EHLO aun.it.uu.se") by vger.kernel.org with ESMTP id S1750755AbVKQKxT (ORCPT ); Thu, 17 Nov 2005 05:53:19 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17276.24851.194332.590736@alkaid.it.uu.se> Date: Thu, 17 Nov 2005 11:53:07 +0100 From: Mikael Pettersson To: "Jordan Crouse" Cc: linux-kernel@vger.kernel.org Subject: Re: PATCH: Fix poor pointer math in devinet_sysctl_register In-Reply-To: <20051116232345.GA872@cosmic.amd.com> References: <20051116232345.GA872@cosmic.amd.com> X-Mailer: VM 7.17 under Emacs 20.7.1 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1355 Lines: 34 Jordan Crouse writes: > This patch fixes pointer math that under certain circumstances, results > in really bad pointers. This was encountered on a system compiled for i486, so > other compilers may differ, but I don't think it hurts anyone. > > Signed-off-by: Jordan Crouse > --- > > net/ipv4/devinet.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c > index 4ec4b2c..7585fce 100644 > --- a/net/ipv4/devinet.c > +++ b/net/ipv4/devinet.c > @@ -1454,7 +1454,7 @@ static void devinet_sysctl_register(stru > return; > memcpy(t, &devinet_sysctl, sizeof(*t)); > for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { > - t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; > + t->devinet_vars[i].data += (int)((char *)p - (char *)&ipv4_devconf); > t->devinet_vars[i].de = NULL; > } This is the same code which broke due to a known gcc-4.0.0 bug: . If you're indeed using gcc-4.0.0, then it's time to upgrade. /Mikael - 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/