[coreboot] libpayload: Fix a small but aggressive bug in printf()

Jordan Crouse jordan.crouse at amd.com
Sat Apr 26 01:11:03 CEST 2008


On 25/04/08 19:05 -0400, Ward Vandewege wrote:
> On Fri, Apr 25, 2008 at 03:59:51PM -0600, Jordan Crouse wrote:
> > On 25/04/08 20:57 +0200, Peter Stuge wrote:
> > > On Fri, Apr 25, 2008 at 09:52:13AM -0600, jordan.crouse at amd.com wrote:
> > > > This was causing the returned counter value to be one more then it
> > > > should be when printing a single character.
> > > > 
> > > > Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
> > > > Index: libpayload/libc/printf.c
> > > > ===================================================================
> > > > --- libpayload.orig/libc/printf.c	2008-04-24 11:44:17.000000000 -0600
> > > > +++ libpayload/libc/printf.c	2008-04-24 11:45:40.000000000 -0600
> > > > @@ -156,7 +156,7 @@
> > > >  			++counter;
> > > >  	}
> > > >  
> > > > -	return ++counter;
> > > > +	return counter;
> > > 
> > > What about the cases when printf() does not print more than one
> > > character? Does the simple fix cover all cases?
> > 
> > Yeah - it should.  The counter is already incremented previously in
> > the function, just above the context for this patch.
> 
> Acked-by: Ward Vandewege <ward at gnu.org>

r3271. Thanks.

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.





More information about the coreboot mailing list