[coreboot] r3474 - in trunk/payloads/libpayload: drivers i386 include
Jordan Crouse
jordan.crouse at amd.com
Sat Aug 9 22:09:22 CEST 2008
On 09/08/08 21:31 +0200, Peter Stuge wrote:
> On Sat, Aug 09, 2008 at 09:27:58PM +0200, Ulf Jordan wrote:
> > On Sat, 9 Aug 2008, Stefan Reinauer wrote:
> > >void * is a good idea here.
> >
> > I sent a patch along those lines in this thread earlier today
> > (10:21:43 +0200 (CEST)), chaning to void * in libpayload.h and
> > memory.c. Does it do the right thing?
>
> If not, it is very close.
>
>
> On Sat, Aug 09, 2008 at 10:21:43AM +0200, Ulf Jordan wrote:
> > Fix signedness problem in memcmp.
> >
> > Signed-off-by: Ulf Jordan <jordan at chalmers.se>
> >
> > Index: libpayload/include/libpayload.h
> > ===================================================================
> > --- libpayload/include/libpayload.h (revision 3478)
> > +++ libpayload/include/libpayload.h (arbetskopia)
> > @@ -179,7 +179,7 @@
> > void *memset(void *s, int c, size_t n);
> > void *memcpy(void *dst, const void *src, size_t n);
> > void *memmove(void *dst, const void *src, size_t n);
> > -int memcmp(const char *s1, const char *s2, size_t len);
> > +int memcmp(const void *s1, const void *s2, size_t len);
> >
> > /* libc/printf.c */
> > int snprintf(char *str, size_t size, const char *fmt, ...);
> > Index: libpayload/libc/memory.c
> > ===================================================================
> > --- libpayload/libc/memory.c (revision 3478)
> > +++ libpayload/libc/memory.c (arbetskopia)
> > @@ -107,8 +107,8 @@
> > * @return If len is 0, return zero. If the areas match, return zero.
> > * Otherwise return non-zero.
> > */
> > -int memcmp(const char *s1, const char *s2, size_t len)
> > +int memcmp(const void *s1, const void *s2, size_t len)
> > {
> > - for (; len && *s1++ == *s2++; len--) ;
> > + for (; len && *(char *)s1++ == *(char *)s2++; len--) ;
> > return len;
> > }
>
> Maybe cast to unsigned char or u8 instead?
Yes - we should cast to unsigned everywhere in here.
Jordan
--
Jordan Crouse
Systems Software Development Engineer
Advanced Micro Devices, Inc.
More information about the coreboot
mailing list