|
From: Banibrata D. <du...@in...> - 2004-04-17 11:18:20
|
in the following snippet of code:
UdpMsg::UdpMsg(int sockId) : mSockId(sockId), mMsgPtr(0), mMsgLen(0)
{
}
int UdpMsg::sendMsg ()
{
int retval=0;
if ((!mMsgPtr) || (!mMsgLen))
return (-1);
if ((retval = send(mSockId, (const void *)mMsgPtr, mMsgLen, 0)) == -1)
...
}
inspite of initializing all the variable i.e.
int mSockId;
char* mMsgPtr;
int mMsgLen;
in the c'tor, i am still getting the error...
==4975== Syscall param socketcall.send(msg) contains uninitialised or
unaddressable byte(s)
==4975== at 0x3C244752: send (in /lib/i686/libc-2.2.4.so)
==4975== by 0x804C49F: UdpMsg::sendMsg(void) (UdpMsg.C:122)
==4975== by 0x804AE3C: Provider::inboundCallRsp(Context &)
(Provider.C:119)
==4975== by 0x804FAC7: Listener::inboundCallInd(Context &,
basic_string<char, string_char_traits<char>, __default_alloc_template<true,
0> > const &, Listener::ReqType)
why so ?
thanks & regards,
Banibrata Dutta
Hewlett-Packard ISO Pvt. Ltd,
29, Cunningham Road,
Bangalore - 560052, India.
Tel: +91-80-22051796
|
|
Re: [Valgrind-users] Syscall param socketcall.send(msg) contains
uninitialised or unaddressable byte
From: Nicholas N. <nj...@ca...> - 2004-04-17 11:34:07
|
On Sat, 17 Apr 2004, Banibrata Dutta wrote:
> int UdpMsg::sendMsg ()
> {
> int retval=0;
> if ((!mMsgPtr) || (!mMsgLen))
> return (-1);
> if ((retval = send(mSockId, (const void *)mMsgPtr, mMsgLen, 0)) == -1)
> ...
> }
>
> inspite of initializing all the variable i.e.
> int mSockId;
> char* mMsgPtr;
> int mMsgLen;
>
> in the c'tor, i am still getting the error...
>
> ==4975== Syscall param socketcall.send(msg) contains uninitialised or
> unaddressable byte(s)
> ==4975== at 0x3C244752: send (in /lib/i686/libc-2.2.4.so)
> ==4975== by 0x804C49F: UdpMsg::sendMsg(void) (UdpMsg.C:122)
> ==4975== by 0x804AE3C: Provider::inboundCallRsp(Context &)
> (Provider.C:119)
> ==4975== by 0x804FAC7: Listener::inboundCallInd(Context &,
> basic_string<char, string_char_traits<char>, __default_alloc_template<true,
> 0> > const &, Listener::ReqType)
>
> why so ?
See section 3.3.5 of the manual again.
(developer.kde.org/~sewardj/docs-2.0.0/mc_main.html#mc-top)
N
|
|
RE: [Valgrind-users] Syscall param socketcall.send(msg) contains uninitialised or unaddressable byte
From: Banibrata D. <du...@in...> - 2004-04-19 05:22:07
|
so, if i do a bzero() or memset() of mMsgPtr (for the entire allocated
size),
this error message should go away ? and same shall be true for my other =
post
?
this is the only thing that was not initialized !!
thanks,
bd
> -----Original Message-----
> From: val...@li...=20
> [mailto:val...@li...] On Behalf=20
> Of Nicholas Nethercote
> Sent: Saturday, April 17, 2004 5:04 PM
> To: Banibrata Dutta
> Cc: val...@li...
> Subject: Re: [Valgrind-users] Syscall param=20
> socketcall.send(msg) contains uninitialised or unaddressable byte
>=20
>=20
> On Sat, 17 Apr 2004, Banibrata Dutta wrote:
>=20
> > int UdpMsg::sendMsg ()
> > {
> > int retval=3D0;
> > if ((!mMsgPtr) || (!mMsgLen))
> > return (-1);
> > if ((retval =3D send(mSockId, (const void *)mMsgPtr,=20
> mMsgLen, 0)) =3D=3D -1)
> > ...
> > }
> >
> > inspite of initializing all the variable i.e.
> > int mSockId;
> > char* mMsgPtr;
> > int mMsgLen;
> >
> > in the c'tor, i am still getting the error...
> >
> > =3D=3D4975=3D=3D Syscall param socketcall.send(msg) contains=20
> uninitialised or=20
> > unaddressable byte(s)
> > =3D=3D4975=3D=3D at 0x3C244752: send (in /lib/i686/libc-2.2.4.so)
> > =3D=3D4975=3D=3D by 0x804C49F: UdpMsg::sendMsg(void) =
(UdpMsg.C:122)
> > =3D=3D4975=3D=3D by 0x804AE3C: Provider::inboundCallRsp(Context =
&)
> > (Provider.C:119)
> > =3D=3D4975=3D=3D by 0x804FAC7: Listener::inboundCallInd(Context =
&,
> > basic_string<char, string_char_traits<char>,=20
> > __default_alloc_template<true,
> > 0> > const &, Listener::ReqType)
> >
> > why so ?
>=20
> See section 3.3.5 of the manual again.
> (developer.kde.org/~sewardj/docs-2.0.0/mc_main.html#mc-top)
>=20
> N
>=20
>=20
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President=20
> and CEO of GenToo technologies. Learn everything from=20
> fundamentals to system=20
> =
administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli=
ck
> _______________________________________________
> Valgrind-users mailing list Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>=20
|
|
RE: [Valgrind-users] Syscall param socketcall.send(msg) contains
uninitialised or unaddressable byte
From: Henrik N. <hn...@ma...> - 2004-04-19 07:25:46
|
On Mon, 19 Apr 2004, Banibrata Dutta wrote: > so, if i do a bzero() or memset() of mMsgPtr (for the entire allocated > size), > this error message should go away? Yes. Or otherwise make sure all bits in the message you send is initialized. If you don't do this you send out "random garbage" in the parts of the message not initialized, and this may include sensitive information about your system or applications. Regards Henrik |
|
RE: [Valgrind-users] Syscall param socketcall.send(msg) contains uninitialised or unaddressable byte
From: Banibrata D. <du...@in...> - 2004-04-19 07:32:02
|
i thought that i'd not have to worry about it. well, actually i am sure i don't have to do that, because in message finally sent out on the wire, is composed by also looking at length of various parameters, s.t. i do not really read any of the garbage octets. thanks & regards, bani. > -----Original Message----- > From: Henrik Nordstrom [mailto:hn...@ma...] > Sent: Monday, April 19, 2004 12:51 PM > To: Banibrata Dutta > Cc: 'Nicholas Nethercote'; val...@li... > Subject: RE: [Valgrind-users] Syscall param > socketcall.send(msg) contains uninitialised or unaddressable byte > > > On Mon, 19 Apr 2004, Banibrata Dutta wrote: > > > so, if i do a bzero() or memset() of mMsgPtr (for the > entire allocated > > size), this error message should go away? > > Yes. Or otherwise make sure all bits in the message you send is > initialized. > > If you don't do this you send out "random garbage" in the > parts of the message not initialized, and this may include > sensitive information about your system or applications. > > Regards > Henrik > |
|
RE: [Valgrind-users] Syscall param socketcall.send(msg) contains
uninitialised or unaddressable byte
From: Henrik N. <hn...@ma...> - 2004-04-19 07:48:22
|
On Mon, 19 Apr 2004, Banibrata Dutta wrote: > i thought that i'd not have to worry about it. well, actually i am > sure i don't have to do that, because in message finally sent out on > the wire, is composed by also looking at length of various parameters, > s.t. i do not really read any of the garbage octets. If valgrind warns on the syscall then there is octets within the sent message which has not been given any value. These octets may contain pretty much any value priorly used in the application or C library. Most often this will be 0, but not always. If you are positively sure all octets in the message should be set and there is no unset fields then you have a bug somewhere in how the message is created or in how it's length is calculated. Regards Henrik |