From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C278A3D0A2; Tue, 19 Dec 2023 22:02:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="En52GGV/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=9fg+mSaYZimcw8y/Rf+e+q5+qIfmlkXuesAXEDPfX40=; b=En52GGV/ikcV6Y3pg2C96xts26 4JqFe2vNHEyY1jHjjOcxMJlWs7zPiiu/AXt+VDe422hQuRFpju1YhYLpC4H4OelaWUKS6KIvIDdY6 COGm0sGAnBEJssBqFh87cVdsSMSaYlss9F1fTMQlo7Dk/a5lanzLAzV7LclxqwEw9VRzd2FtLe6fe ywFFqT+XXsrUmcB8p3FvYa54yxV7jk3Jlud41zRtVJ4qnup+ZyZKUV2bFbneu9dLuTQCYRFQw0TuU zQ//Jpo7iLbNW7fU4Hs/qdSEnyjGQT61PcHfzwwjvslqmSP4rlEuiNUqBMcC27F3cQsdTLtC7/rFz IAjlzbWw==; Received: from [50.53.46.231] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rFiAU-00FYL9-05; Tue, 19 Dec 2023 22:02:26 +0000 Message-ID: Date: Tue, 19 Dec 2023 14:02:25 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] samples/bpf: use %lu format specifier for unsigned long values Content-Language: en-US To: Colin Ian King , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231219152307.368921-1-colin.i.king@gmail.com> From: Randy Dunlap In-Reply-To: <20231219152307.368921-1-colin.i.king@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 Reviewed-by: Randy Dunlap 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