On 10/11/2011 05:33 PM, Denys Vlasenko wrote: > > 2011/10/11 Lambrecht Jürgen <[email protected]>: > > Hello, > > > > The patch below fixes a bug in networking/udhcp/dhcpc.c. Here my > reasoning: > > There are 256 dhcp options supported, so 256 bits to store. > > You want to store that in an unsigned (BITMAP define), 32b in my case. > > So you need an unsigned array of 256/sizeoff(unsigned) == 8 elements. > > sizeof(unsigned) is 4, because sizeof() measures size in bytes, not bits. > oops, indeed (I was thinking too much in hardware ;-) > > > 256/4 = 64. > > > In > > the code, the define BBITS is used for this, and the bug is that *8 is > > added to that define, resulting in an array of only 1 element (32b) to > > store 256 bits. > > I disassembled this: > > memset(found_opts, 0, sizeof(found_opts)); > > and I see that this memset fills 8 words, not 1 word: > > f: b9 08 00 00 00 mov $0x8,%ecx > 14: 31 c0 xor %eax,%eax > 16: f3 ab rep stos %eax,%es:(%edi) > > -- > vda > Indeed, I was wrong - I took the wrong conclusions from my debugging.. So forget the patch. (my problems were actually caused by not understanding 'putenv' and how to use it)
Thanks, Jürgen -- Jürgen Lambrecht R&D Associate Tel: +32 (0)51 303045 Fax: +32 (0)51 310670 http://www.televic-rail.com Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium Company number 0825.539.581 - RPR Kortrijk _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
