lkml.org 
[lkml]   [2023]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] samples/bpf: use %lu format specifier for unsigned long values
From


On 12/19/23 07:23, Colin Ian King wrote:
> Currently %ld format specifiers are being used for unsigned long
> values. Fix this by using %lu instead. Cleans up cppcheck warnings:
>
> warning: %ld in format string (no. 1) requires 'long' but the argument
> type is 'unsigned long'. [invalidPrintfArgType_sint]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

> ---
> samples/bpf/cpustat_user.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/samples/bpf/cpustat_user.c b/samples/bpf/cpustat_user.c
> index ab90bb08a2b4..356f756cba0d 100644
> --- a/samples/bpf/cpustat_user.c
> +++ b/samples/bpf/cpustat_user.c
> @@ -66,10 +66,10 @@ static void cpu_stat_print(void)
>
> printf("CPU-%-6d ", j);
> for (i = 0; i < MAX_CSTATE_ENTRIES; i++)
> - printf("%-11ld ", data->cstate[i] / 1000000);
> + printf("%-11lu ", data->cstate[i] / 1000000);
>
> for (i = 0; i < MAX_PSTATE_ENTRIES; i++)
> - printf("%-11ld ", data->pstate[i] / 1000000);
> + printf("%-11lu ", data->pstate[i] / 1000000);
>
> printf("\n");
> }

--
#Randy
https://people.kernel.org/tglx/notes-about-netiquette
https://subspace.kernel.org/etiquette.html

\
 
 \ /
  Last update: 2023-12-19 23:03    [W:0.042 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site