|
From: Tom Hu <to...@ci...> - 2004-08-19 01:40:04
|
I have question about Conditional jump or move depends on uninitialised
value. I saw a lot error in my code. It is really bothered me.
I used valgrind 2.1.1.
The complain error is:
==31597== Conditional jump or move depends on uninitialised value(s)
==31597== at 0x3C01DFD4: memcmp (mac_replace_strmem.c:323)
==31597== by 0x805F10B: xxx_validate_packet (xxx_parser.c:1219)
==31597== by 0x80685CF: xxx_send_packet (xxx_action.c:48)
==31597== by 0x8068C51: action_send_init_msg (xxx_action.c:281)
==31597==
==31597== Conditional jump or move depends on uninitialised value(s)
==31597== at 0x805F116: xxx_validate_packet (xxx_parser.c:1221)
==31597== by 0x80685CF: xxx_send_packet (xxx_action.c:48)
==31597== by 0x8068C51: action_send_init_msg (xxx_action.c:281)
==31597== by 0x806C442: xxx_sm_internal (xxx_sm.c:261)
==31597==
The source snip is here:
xxx_validate_packet()
{
...
...
int rc = 0;
if (!data) {
return (XXX_ERROR_INVALID_PARAMETER);
}
xxx_debug_from_sa(sa, &debug);
if (!receiver) xxx_log_hdr(&debug, data, receiver);
hdr = (xxx_header *)data;
/* The packet data length has to be the same as ike header length */
if (len != ntohl(hdr->length)) {
return XXX_INVALID_SYNTAX;
}
/* Validate spi */
memset(spi_zero, 0x0, XXX_SPI_SIZE);
/* Init spi MUST NOT be zero */
rc = memcmp(hdr->init_spi, spi_zero, XXX_SPI_SIZE) ;
=====> line 1219
/* if (memcmp(hdr->init_spi, spi_zero, XXX_SPI_SIZE) == 0) { */
if (rc == 0) {
======> line 1221
return XXX_INVALID_SYNTAX;
....
...
...
}
Basically, valgrind complains line 1219 and 1221. I do not see any
problem in 1221. It looks like rc has been initilize when declaring. The
only I suspect is memcmp() call. Are both complained the same problem
from memcmp or not? If those are memcmp problem. What is the possibility
reason? Should I ignore this? If yes, how to do that?
Thanks,
Tom
|