svn commit: r309374 - in head: sbin/camcontrol sys/cam/scsi
Ravi Pokala
rpokala at mac.com
Sat Dec 3 05:38:45 UTC 2016
-----Original Message-----
> From: <owner-src-committers at freebsd.org> on behalf of Kyle Evans <kevans91 at ksu.edu>
> Date: 2016-12-02, Friday at 20:44
> To: "Kenneth D. Merry" <ken at freebsd.org>
> Cc: <src-committers at freebsd.org>, <svn-src-all at freebsd.org>, <svn-src-head at freebsd.org>
> Subject: Re: svn commit: r309374 - in head: sbin/camcontrol sys/cam/scsi
>
>> [...]
>> +
>> + if (action == TIMESTAMP_REPORT) {
>> + error = report_timestamp(device, &ts, retry_count,
>> + timeout);
>> + if (error != 0) {
>> + goto bailout;
>> + } else if (strcmp(format_string, MIL) == 0) {
>> + printf("Timestamp in milliseconds: %ju\n",
>> + (uintmax_t)ts);
>> + } else {
>> + char temp_timestamp_string[100];
>> + time_t time_var = ts / 1000;
>
> Hi,
>
> FWIW: Building -CURRENT on mips.mips (w/ freebsd-wifi-build),
> mips-gcc gets upset at the above line with the following error:
>
> /wifi-build/src/sbin/camcontrol/timestamp.c: In function 'timestamp':
> /wifi-build/src/sbin/camcontrol/timestamp.c:459:25: error: 'ts' may be
> used uninitialized in this function [-Werror=maybe-uninitialized]
> time_t time_var = ts / 1000;
Interesting. I just did a tinderbox build earlier this evening, and this wasn't reported.
> I understand that this is a bogus error because at this point it
> pretty much *has* to be set by the report_timestamp call just prior,
> but is there a clean way to trick GCC into agreeing, or is it just a
> matter of explicitly initializing it to 0 before the report_timestamp
> call?
Actually, it's a valid warning. While all paths to that point in timestamp() go through report_timestamp(), not all paths through report_timestamp() set *ts. Specifically, if cam_getccb() or cam_send_ccb() fail, or the request was not completed, report_timestamp() does 'goto bailout' without setting *ts.
I'm disappointed that `clang' (on i386 and amd64) didn't notice this; I was under the impression `clang' did more of that type of deep path analysis than `gcc'. <shrug>
-Ravi (rpokala@)
> Thanks,
>
> Kyle Evans
More information about the svn-src-all
mailing list