|
From: Daniel M. \(IMI\) <da...@im...> - 2004-09-28 17:36:08
|
First, I *do* compile with -Wall (I learned that lesson a LONG time ago!!!).
Also, my code has been linted and is lint-clean.
Here's the get_number_of_luns() function:
//**************************************************************************
**
static int get_number_of_luns(usb_dev_handle *udev)
{
char xbuf ;
// swap bytes around because u16 fields in
// usb_control_msg() are big-endian
int result = usb_control_msg(udev, // handle
0xA1, // requesttype
0xFE, // request
0, // value
0, // index
&xbuf, // data pointer
1, // length
5000) ; // timeout
if (result < 0)
return result;
result = (int) (xbuf) + 1 ;
return result;
}
The A1/FE control message returns one byte. So it doesn't look, to me, as
though get_number_of_luns() can fail to return a value...
Dan
----- Original Message -----
From: "Robert Walsh" <rj...@du...>
To: "Daniel Miller" <da...@im...>
Cc: <val...@li...>
Sent: Tuesday, September 28, 2004 10:29
Subject: Re: [Valgrind-users] improbably "uninitialized value" warning
> > I'm using valgrind 2.2.0 for the first time, on a linux 2.6.7 system
with
> > gcc 3.3.4. I have optimizations set to -O. However, I'm getting *many*
> > warnings about "Conditional jump or move depends on uninitialized
value"...
> > some of these warnings are clearly spurious; a typical example is:
> >
> > result = get_number_of_luns(udev) ;
> > total_luns = (result <= 0) ? 1 : result ; // line 1449
> >
> > ==25533== Conditional jump or move depends on uninitialised value(s)
> > ==25533== at 0x805AC84: find_dev_cap(unsigned) (imilib.cpp:1449)
> >
> > result is defined as int, and get_number_of_luns() returns int. So
result
> > cannot be uninitialized here.
> >
> > I even tried removing optimization flags entirely, but it didn't change
> > these warnings. What, if anything, can I do to resolve these warnings
and
> > get down to valid messages??
>
> Check to see if get_number_of_luns is returning an initialized value.
> Valgrind won't report that on exit of get_number_of_luns, but it will
> pass the uninitialized value around and Valgrind will detect when it's
> used to make a decision. Try compiling it with -Wall to see if gcc
> spots anything.
>
>
>
|