From: Ling, X. <xia...@in...> - 2004-04-20 01:05:38
|
Great catch, this is really an ugly bug. > -----Original Message----- > From: Mark Haverkamp [mailto:ma...@os...]=20 > Sent: 2004=C4=EA4=D4=C220=C8=D5 5:24 > To: Ling, Xiaofeng; Guo, Min; tipc > Subject: bcast.c patch >=20 >=20 > I found a problem initializing a bcastlink bitmap. Too much=20 > memory was being zeroed out corrupting memory and causing=20 > strange behavior. I changed the memset to only zero out the=20 > size of the bitmap array.=20 > (Using BIT_NODES*sizeof(unsigned long) would have worked too,=20 > but using this method, you are always going to fill the=20 > correct amount even if you change the data type someday). I=20 > have included a patch for review. >=20 > Mark. >=20 >=20 > Index: bcast.c=20 > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvsroot/tipc/source/unstable/net/tipc/bcast.c,v > retrieving revision 1.15 > diff -u -r1.15 bcast.c > --- bcast.c 19 Apr 2004 16:12:28 -0000 1.15 > +++ bcast.c 19 Apr 2004 21:16:18 -0000 > @@ -317,7 +317,7 @@ > blink->bitmap[i] =3D 0; > INIT_LIST_HEAD(&blink->list); > blink->mask =3D=20 > (tipc_addr(tipc_zone(tipc_own_addr),tipc_cluster(tipc_own_addr),0));=09 > - memset(blink->bitmap, 0, MAX_NODES*sizeof(unsigned long)); > + memset(blink->bitmap, 0, sizeof(blink->bitmap)); > list_add_tail(&(blink->list),&blink_head); > return blink; > =09 >=20 > --=20 > Mark Haverkamp <ma...@os...> >=20 >=20 |