[lustre-devel] linux-4.5/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c:880: wrong % specifier ?

David Binderman dcb314 at hotmail.com
Mon Mar 14 16:09:37 PDT 2016


Hello there,

----------------------------------------
>  so I suspect there are a large number of such warnings that need to be repaired.

About a dozen:

$ fgrep "(warning)" cppcheck.45.all.out | fgrep /lustre/ | fgrep "in format string" | sort | uniq | more
[linux-4.5/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c:880]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
[linux-4.5/drivers/staging/lustre/lustre/llite/lproc_llite.c:649]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[linux-4.5/drivers/staging/lustre/lustre/llite/lproc_llite.c:699]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[linux-4.5/drivers/staging/lustre/lustre/mdc/lproc_mdc.c:53]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[linux-4.5/drivers/staging/lustre/lustre/osc/lproc_osc.c:243]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
[linux-4.5/drivers/staging/lustre/lustre/osc/lproc_osc.c:260]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
[linux-4.5/drivers/staging/lustre/lustre/osc/lproc_osc.c:307]: (warning) %lu in format string (no. 1) requires 'unsigned long' but the argument type is 'signed long'.
[linux-4.5/drivers/staging/lustre/lustre/osc/lproc_osc.c:472]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[linux-4.5/drivers/staging/lustre/lustre/osc/lproc_osc.c:497]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[linux-4.5/drivers/staging/lustre/lustre/osc/lproc_osc.c:88]: (warning) %u in format string (no. 1) requires 'unsigned int' but the argument type is 'signed int'.
[linux-4.5/drivers/staging/lustre/lustre/ptlrpc/service.c:2437]: (warning) %d in format string (no. 3) requires 'int' but the argument type is 'unsigned int'.
[linux-4.5/drivers/staging/lustre/lustre/ptlrpc/service.c:2440]: (warning) %d in format string (no. 2) requires 'int' but the argument type is 'unsigned int'.
$ 

The messages are generated by cppcheck, a static analysis tool, not gcc.


Regards

David Binderman

>
> Cheers, Andreas
>
>> On Mar 14, 2016, at 13:36, David Binderman <dcb314 at hotmail.com> wrote:
>>
>> Hello there,
>>
>> [linux-4.5/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c:880]: (warning) %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'.
>>
>> Source code is
>>
>> return sprintf(buf, "%d\n", ldlm_cancel_unused_locks_before_replay);
>>
>> but
>>
>> extern unsigned int ldlm_cancel_unused_locks_before_replay;
>>
>> Suggest use %u, not %d.
>>
>>
>> Regards
>>
>> David Binderman
>>
 		 	   		  


More information about the lustre-devel mailing list