From patchwork Sun Sep 3 15:22:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?0L3QsNCx?= X-Patchwork-Id: 13373279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20061C83F2D for ; Sun, 3 Sep 2023 15:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232142AbjICPXB (ORCPT ); Sun, 3 Sep 2023 11:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjICPXB (ORCPT ); Sun, 3 Sep 2023 11:23:01 -0400 Received: from tarta.nabijaczleweli.xyz (tarta.nabijaczleweli.xyz [139.28.40.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56596F1 for ; Sun, 3 Sep 2023 08:22:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nabijaczleweli.xyz; s=202305; t=1693754577; bh=sxo5ccr1lY+PT2swNH9zD9KjzRy2UjHSRv9Vo0OLvIM=; h=Date:From:To:Subject:References:In-Reply-To:From; b=FK4Yus8OQ9k/2XyxDi+3Jn0+TqJQirritZxV3fJHjKoSi/6ZM0ApwzVGyThKlcq40 yfVVoeciYldI1qBBu1MccMd5ZE+Qj6PElvyLVQCivM0Ai8b6QWll2ZUxmGKZZLcIm4 j9EFKhIKaPTV/FkOZhNG8fVmvpmMtD2P4qCVrhqa1Ejcla+8UMqrV4STzowGJj06i8 v6ZfWswBQ1kO68d+c7sAuYUG4vgQejw6MrP4NZv3r8Frg/hZlInOsL/0+P+CIA5hOK xWVi/ZR1kokSbfE23ceS0vHzw30JcZ7enUlBlfnyHwBZH8MPrtBrcuSJlF578Vu/KZ /Q/i0h8ZGFDhg== Received: from tarta.nabijaczleweli.xyz (unknown [192.168.1.250]) by tarta.nabijaczleweli.xyz (Postfix) with ESMTPSA id 08CB9B3B0 for ; Sun, 3 Sep 2023 17:22:57 +0200 (CEST) Date: Sun, 3 Sep 2023 17:22:55 +0200 From: Ahelenia =?utf-8?q?Ziemia=C5=84ska?= To: linux-nfs@vger.kernel.org Subject: [PATCH nfs-utils 2/2] testlk: format off_t as llong instead of ssize_t Message-ID: <44adec629186e220ee5d8fd936980ac4a33dc510.1693754442.git.nabijaczleweli@nabijaczleweli.xyz> References: <04f3fe71defa757d518468f04f08334a5d0dfbb9.1693754442.git.nabijaczleweli@nabijaczleweli.xyz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <04f3fe71defa757d518468f04f08334a5d0dfbb9.1693754442.git.nabijaczleweli@nabijaczleweli.xyz> User-Agent: NeoMutt/20230517 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This, naturally, produces a warning on x32 (and other ILP32 platforms with 64-bit off_t, presumably, but you need to ask for it explicitly there usually): gcc -DHAVE_CONFIG_H -I. -I../../support/include -D_GNU_SOURCE -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -g -O2 -ffile-prefix-map=/tmp/nfs-utils-2.6.3=. -specs=/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/tmp/nfs-utils-2.6.3=. -specs=/usr/share/dpkg/pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -c -o testlk-testlk.o `test -f 'testlk.c' || echo './'`testlk.c testlk.c: In function ‘main’: testlk.c:84:66: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 4 has type ‘__off_t’ {aka ‘long long int’} [-Wformat=] 84 | printf("%s: conflicting lock by %d on (%zd;%zd)\n", | ~~^ | | | int | %lld 85 | fname, fl.l_pid, fl.l_start, fl.l_len); | ~~~~~~~~~~ | | | __off_t {aka long long int} testlk.c:84:70: warning: format ‘%zd’ expects argument of type ‘signed size_t’, but argument 5 has type ‘__off_t’ {aka ‘long long int’} [-Wformat=] 84 | printf("%s: conflicting lock by %d on (%zd;%zd)\n", | ~~^ | | | int | %lld 85 | fname, fl.l_pid, fl.l_start, fl.l_len); | ~~~~~~~~ | | | __off_t {aka long long int} Upcast to long long, doesn't really matter. It does, of course, raise the question of whether other bits of nfs-utils do something equally broken that just isn't caught by the format validator. Signed-off-by: Ahelenia Ziemiańska --- tools/locktest/testlk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/locktest/testlk.c b/tools/locktest/testlk.c index ea51f788..c9bd6bac 100644 --- a/tools/locktest/testlk.c +++ b/tools/locktest/testlk.c @@ -81,8 +81,8 @@ main(int argc, char **argv) if (fl.l_type == F_UNLCK) { printf("%s: no conflicting lock\n", fname); } else { - printf("%s: conflicting lock by %d on (%zd;%zd)\n", - fname, fl.l_pid, fl.l_start, fl.l_len); + printf("%s: conflicting lock by %d on (%lld;%lld)\n", + fname, fl.l_pid, (long long)fl.l_start, (long long)fl.l_len); } return 0; }