From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Gibson Subject: Re: [PATCH] Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3. Date: Fri, 26 Sep 2008 11:29:34 +1000 Message-ID: <20080926012934.GD13228@yookeroo.seuss> References: <1222358537.25112.7.camel@ld0161-tx32> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1222358537.25112.7.camel@ld0161-tx32> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-mnsaURCQ41sdnm+yROfE0A@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-mnsaURCQ41sdnm+yROfE0A@public.gmane.org To: Jon Loeliger Cc: devicetree-discuss , Stephen Papacharalambous List-Id: devicetree@vger.kernel.org On Thu, Sep 25, 2008 at 11:02:17AM -0500, Jon Loeliger wrote: > > Using Gcc 4.3 detected this problem: > > ../dtc/libfdt/fdt.c: In function 'fdt_next_tag': > ../dtc/libfdt/fdt.c:82: error: assuming signed overflow does not > occur when assuming that (X + c) < X is always false Um... I'm a little baffled by this warning, given that the line in question is actually testing that (X+c) < X is false.. > To fix the problem, treat the offset as an unsigned int. Nor am I entirely sure how that's supposed to help, since an unsigned overflow is also possible. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson