Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2520514rdb; Wed, 4 Oct 2023 04:02:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGDTGgGGNp3PuGpAKbTTKjU1GXB8BARmzNpCxTK/2hMs22JOc1nIMgE0o3L3O5Pnp3h+H3/ X-Received: by 2002:a17:902:ecd1:b0:1c0:cbaf:6930 with SMTP id a17-20020a170902ecd100b001c0cbaf6930mr1870891plh.54.1696417334659; Wed, 04 Oct 2023 04:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696417334; cv=none; d=google.com; s=arc-20160816; b=XH0DPUGeg1rB3Z/6S9/RKTLEPMNpipgE2Ws2ZiQ2sXh2+a7Xk10vLt194HrNob5nfY Pu7zXjxSSzesrx8zBDB73OR2VrjPMuoTpIFONDEjgHT+7RpDrjnxhxGd66kCFA5dC5XE Eq3VBU/5r0yWimphzKdez2MSHrzEJbedEazQh4bVDkrpxZjiUcJ2UL8742xNgZgdp3Qn IDCgWzEPd1hopkCPd5hqYSRykpafk3SWYFt5/ETHNSwbOV6do1/LY6vHPomlfxCg3Qqv Tl4Cw5mw76KdFsJm2Jl1xA9HdRenFSDFPcwQKo2pkMKB1TjsFrvWeXjmV63pm6awzHbc FkmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WB4bHf2xPcB2DN5drew8jbBWfZbz1hdkF1+eMxO8NlI=; fh=S/dDF7LZKBvDVCryeu+lWv+PnilJqdlqBS57q/glL/E=; b=vtzXCPjFONFM5XmK3U0xNzFhBgFNLib+k0xn3Kgu9badtm0pwKi9TPwM/QiWoW0+gK Lko2G8oOGwcECVG7zz1i1ka53xUJrHBll7dQG8scI/x8uFBAYjRQmvHfqZOMwsCmPsBY HDgKcpbT1mIyN6N1f1kTNs9ZxP+w4vvBKequ7xFp4QP5nKM9ySAWBgfPm6gBK/z+KO+6 ksl95qHC/7lSSozUpwkvJDL1QnI2U9mDLaYElfVcmyq1KsInjOM4J/MRcBzid/Y6clKR P3XstpHPj4uO+3FukzalQtSyV2eyq2CVEzaq26uvngiG6LJJV4DPf9RSQXPydZMDDc3F Daew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=NlG1gyKY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k12-20020a170902d58c00b001c60f6cf46bsi3445504plh.12.2023.10.04.04.02.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 04:02:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=NlG1gyKY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 57AC2825EDBC; Wed, 4 Oct 2023 04:02:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242127AbjJDLBz (ORCPT + 99 others); Wed, 4 Oct 2023 07:01:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242051AbjJDLBx (ORCPT ); Wed, 4 Oct 2023 07:01:53 -0400 Received: from smtp-8fa8.mail.infomaniak.ch (smtp-8fa8.mail.infomaniak.ch [83.166.143.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0E23BD for ; Wed, 4 Oct 2023 04:01:48 -0700 (PDT) Received: from smtp-3-0001.mail.infomaniak.ch (unknown [10.4.36.108]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4S0sFl0WlJzMqGWl; Wed, 4 Oct 2023 11:01:47 +0000 (UTC) Received: from unknown by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4S0sFf5pRbzMppB8; Wed, 4 Oct 2023 13:01:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1696417306; bh=gWybje2HvLgDOH5ZYG1Lx+4xobEwytv14WvC0k0ZXhQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=NlG1gyKYLonJ1+MJppZUKCtoojLOgIeJbKleESzlTWhJtG4VndWzCUSU64xXJh6iu T7kCQFVJV6tXIWJ9h2K86LxQSFmErn/4HiC2IYPyQNTVfJ3gA12QhyEXH8o7DQzUOK kq+wAhIkTPO2dLkT8kJDGGiT3OXNWvnZsMHiDrF8= Date: Wed, 4 Oct 2023 13:01:45 +0200 From: =?utf-8?Q?Micka=C3=ABl_Sala=C3=BCn?= To: Geert Uytterhoeven Cc: Stephen Rothwell , Konstantin Meskhidze , Linux Kernel Mailing List , Linux Next Mailing List , willemdebruijn.kernel@gmail.com, gnoack3000@gmail.com, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, yusongping@huawei.com, artem.kuzin@huawei.com, Arnd Bergmann , Randy Dunlap Subject: Re: linux-next: build warning after merge of the landlock tree Message-ID: <20231004.SeachioS1aop@digikod.net> References: <20231003142737.381e7dcb@canb.auug.org.au> <20230920092641.832134-12-konstantin.meskhidze@huawei.com> <20231003.ahPha5bengee@digikod.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Infomaniak-Routing: alpha X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 04:02:08 -0700 (PDT) On Tue, Oct 03, 2023 at 03:23:22PM +0200, Geert Uytterhoeven wrote: > Hi Mickaël, > > On Tue, Oct 3, 2023 at 3:15 PM Mickaël Salaün wrote: > > On Tue, Oct 03, 2023 at 02:27:37PM +1100, Stephen Rothwell wrote: > > > After merging the landlock tree, today's linux-next build (powerpc > > > allyesconfig) produced this warning: > > > > > > samples/landlock/sandboxer.c: In function 'populate_ruleset_net': > > > samples/landlock/sandboxer.c:170:78: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type '__u64' {aka 'long unsigned int'} [-Wformat=] > > > 170 | "Failed to update the ruleset with port \"%llu\": %s\n", > > > | ~~~^ > > > | | > > > | long long unsigned int > > > | %lu > > > 171 | net_port.port, strerror(errno)); > > > | ~~~~~~~~~~~~~ > > > | | > > > | __u64 {aka long unsigned int} > > > > > > Introduced by commit > > > > > > 24889e7a2079 ("samples/landlock: Add network demo") > > > > PowerPC-64 follows the LP64 data model and then uses int-l64.h (instead of > > int-ll64.h like most architectures) for user space code. > > > > Here is the same code with the (suggested) "%lu" token on x86_86: > > > > samples/landlock/sandboxer.c: In function ‘populate_ruleset_net’: > > samples/landlock/sandboxer.c:170:77: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘__u64’ {aka ‘long long unsigned int’} [-Werror=format=] > > 170 | "Failed to update the ruleset with port \"%lu\": %s\n", > > | ~~^ > > | | > > | long unsigned int > > | %llu > > 171 | net_port.port, strerror(errno)); > > | ~~~~~~~~~~~~~ > > | | > > | __u64 {aka long long unsigned int} > > > > > > We would then need to cast __u64 to unsigned long long to avoid this warning, > > which may look useless, of even buggy, for people taking a look at this sample. > > In userspace code, you are supposed to #include > and use PRIu64. Thanks for these tips! > > > Anyway, it makes more sense to cast it to __u16 because it is the > > expected type for a TCP port. I'm updating the patch with that. > > Konstantin, please take this fix for the next series: > > https://git.kernel.org/mic/c/fc9de206a61a > > Until someone passes a too large number, and it becomes truncated... That should not happen because it is checked by the kernel (for this specific case), but let's make it simple and print the 64-bit value. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds