Message ID | 20230331074919.1299425-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp395698vqo; Fri, 31 Mar 2023 01:06:07 -0700 (PDT) X-Google-Smtp-Source: AKy350argMbPrEh9swgnCuLeRrEFb4ebXGWyn1bx771kgNmoAGOOaV9gBSKeutkGmXy2aEF2h9XK X-Received: by 2002:aa7:95a4:0:b0:626:dc8:b004 with SMTP id a4-20020aa795a4000000b006260dc8b004mr26879138pfk.26.1680249967484; Fri, 31 Mar 2023 01:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680249967; cv=none; d=google.com; s=arc-20160816; b=UsI1aVa9OU3A53y03zmTGcVtiUoFYlUJ5xK5vP9il9FSWDgf0UyK/1UmU4qkEl6s5/ JVRHooopLE3KY7h36Pmy3wVFFwwnVTILozlgK644/rApZjPeTxGB6RvEOxTz9VIKGgtu guovQKJmgIetNYhAs5ZxxvrEnfXFarEqH+VUKzlFmCoSSbTSDy+JRMmo2YrmvSW0s8hr t0B1HnvcFPO5apG6U73QJhm3FtlAkXIMkH3GyOU5la3KdE/oRWUMBcvGfUMN5rl1Tcuf qhf9wpyBQsh9VSGhTK+12Qx7P0JwrKB61KXucDLGgoWZxKQFM/T50/z7nX0yw3OKlSYk LMCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mVbqrDFLLrA7llDsTps4aLTl9CqTx0M8tAkga7RzY3I=; b=iC6dGJhShSbR3oHCwSnN8nuz2kJ2H+vPBMgAXRrey4Tsi8FBJoIE6+LGvrNIlI3Sof kQGGwkE5AKit0Us1ReP8tSra/tHzlm9TzGdp5+i2xkMZOTBXLDhzJudus2HuNH51ojue PednxygAkGXlaopK/ZThJbyZpg5iYibDWxOz+3nhmmXgwY2Y2mOqcyuc7KJHzqZQxnvq AQSmNaNQOdFgFGjFzsMHPEXjOkZP0mfBDglDlhpyzuTj/o5PxhDBCDsxyrN5bN+3tdTV vZoBfFe28v1O+bbkkpWlWHlJ/ZjYl5c1mBS2LJ0wD8yUEV7p4Nqu7QQsEjepvIA7a3a/ BxiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=txDP4opP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x9-20020aa79a49000000b0062d7d3c6cc8si1900962pfj.375.2023.03.31.01.05.55; Fri, 31 Mar 2023 01:06:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=txDP4opP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231352AbjCaHvI (ORCPT <rfc822;jimliu8233@gmail.com> + 99 others); Fri, 31 Mar 2023 03:51:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230470AbjCaHuo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 31 Mar 2023 03:50:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A70E31D919; Fri, 31 Mar 2023 00:49:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91D116243A; Fri, 31 Mar 2023 07:49:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E62B5C433EF; Fri, 31 Mar 2023 07:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680248966; bh=N52cquANgi8rH2muZ2w4PLKijbErjnK0PBHAsGbh9ZA=; h=From:To:Cc:Subject:Date:From; b=txDP4opP0hB4ki+4IXdW6ZBivfJPmobPRfqmXFKoadzILc7fafaku2vLt9m1dU71N KvtW8HNCEQfIsDb8aGnWq5ZabC6920pWQ1uGwV3LJKh1bEj/S/UUaMJAHvAgXdtzMk auA4i74PApfg9l/0yYBHwGHmWcRw32bNbaVJUwRes1ADjJluT9cyxOOc9xCfdHrvLv 9jRpGDQUx1PplDu03B/KMzqTY8Bjibhc3qJ2BFxfIOScXWxpJuT59a7eNAH4Ky952r oDppEQm+oKN2gin7Noi125pvZtpjfD8vQdetVV02Iq/EvRaJNYRcW1u3FBd17RMAae v9qRmJ4zHL/QQ== From: Arnd Bergmann <arnd@kernel.org> To: Jakub Kicinski <kuba@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Paolo Abeni <pabeni@redhat.com>, Nikolay Aleksandrov <razor@blackwall.org>, Jason Xing <kerneljasonxing@gmail.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int' Date: Fri, 31 Mar 2023 09:48:56 +0200 Message-Id: <20230331074919.1299425-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761869789660660863?= X-GMAIL-MSGID: =?utf-8?q?1761869789660660863?= |
Series |
net: netcp: MAX_SKB_FRAGS is now 'int'
|
|
Commit Message
Arnd Bergmann
March 31, 2023, 7:48 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The type of MAX_SKB_FRAGS has changed recently, so the debug printk needs to be updated: drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=] 2084 | dev_err(dev, "tx-pool size too small, must be at least %ld\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/net/ethernet/ti/netcp_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Fri, 31 Mar 2023 09:48:56 +0200 you wrote: > From: Arnd Bergmann <arnd@arndb.de> > > The type of MAX_SKB_FRAGS has changed recently, so the debug printk > needs to be updated: > > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=] > 2084 | dev_err(dev, "tx-pool size too small, must be at least %ld\n", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > [...] Here is the summary with links: - net: netcp: MAX_SKB_FRAGS is now 'int' https://git.kernel.org/netdev/net/c/c5b959eeb7f9 You are awesome, thank you!
From: Arnd Bergmann <arnd@kernel.org> Date: Fri, 31 Mar 2023 09:48:56 +0200 > From: Arnd Bergmann <arnd@arndb.de> > > The type of MAX_SKB_FRAGS has changed recently, so the debug printk > needs to be updated: > > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=] > 2084 | dev_err(dev, "tx-pool size too small, must be at least %ld\n", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/net/ethernet/ti/netcp_core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c > index 1bb596a9d8a2..dfdbcdeb991f 100644 > --- a/drivers/net/ethernet/ti/netcp_core.c > +++ b/drivers/net/ethernet/ti/netcp_core.c > @@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device, > netcp->tx_pool_region_id = temp[1]; > > if (netcp->tx_pool_size < MAX_SKB_FRAGS) { > - dev_err(dev, "tx-pool size too small, must be at least %ld\n", > + dev_err(dev, "tx-pool size too small, must be at least %d\n", > MAX_SKB_FRAGS); > ret = -ENODEV; > goto quit; (not related to the actual fix) I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`. It can't be below zero or above %U32_MAX and we have to define it manually anyway, so why not cast to the type expected from it :D Thanks, Olek
On Fri, Mar 31, 2023 at 5:08 PM Alexander Lobakin <aleksander.lobakin@intel.com> wrote: > > From: Arnd Bergmann <arnd@kernel.org> > Date: Fri, 31 Mar 2023 09:48:56 +0200 > > > From: Arnd Bergmann <arnd@arndb.de> > > > > The type of MAX_SKB_FRAGS has changed recently, so the debug printk > > needs to be updated: > > > > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': > > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=] > > 2084 | dev_err(dev, "tx-pool size too small, must be at least %ld\n", > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS") > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > --- > > drivers/net/ethernet/ti/netcp_core.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c > > index 1bb596a9d8a2..dfdbcdeb991f 100644 > > --- a/drivers/net/ethernet/ti/netcp_core.c > > +++ b/drivers/net/ethernet/ti/netcp_core.c > > @@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device, > > netcp->tx_pool_region_id = temp[1]; > > > > if (netcp->tx_pool_size < MAX_SKB_FRAGS) { > > - dev_err(dev, "tx-pool size too small, must be at least %ld\n", > > + dev_err(dev, "tx-pool size too small, must be at least %d\n", > > MAX_SKB_FRAGS); > > ret = -ENODEV; > > goto quit; > > (not related to the actual fix) > > I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`. > It can't be below zero or above %U32_MAX and we have to define it > manually anyway, so why not cast to the type expected from it :D > Some files have the assumption MAX_SKB_FRAGS can be understood by the C preprocessor. #if MAX_SKB_FRAGS > 32 ... Kconfig does not allow to define unsigned int. That would be the easiest way really...
On Fri, Mar 31, 2023 at 08:40:18AM +0000, patchwork-bot+netdevbpf@kernel.org wrote: > Hello: > > This patch was applied to netdev/net.git (main) > by David S. Miller <davem@davemloft.net>: > > On Fri, 31 Mar 2023 09:48:56 +0200 you wrote: > > From: Arnd Bergmann <arnd@arndb.de> > > > > The type of MAX_SKB_FRAGS has changed recently, so the debug printk > > needs to be updated: > > > > drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': > > drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'int' [-Werror=format=] > > 2084 | dev_err(dev, "tx-pool size too small, must be at least %ld\n", > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > [...] > > Here is the summary with links: > - net: netcp: MAX_SKB_FRAGS is now 'int' > https://git.kernel.org/netdev/net/c/c5b959eeb7f9 net now warns: In file included from include/linux/device.h:15, from include/linux/dma-mapping.h:7, from include/linux/skbuff.h:28, from include/linux/if_ether.h:19, from include/linux/ethtool.h:18, from include/linux/phy.h:16, from include/linux/of_net.h:9, from drivers/net/ethernet/ti/netcp_core.c:16: drivers/net/ethernet/ti/netcp_core.c: In function 'netcp_create_interface': drivers/net/ethernet/ti/netcp_core.c:2084:30: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int' [-Werror=format=] 2084 | dev_err(dev, "tx-pool size too small, must be at least %d\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); \ | ^~~ include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt' 144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/net/ethernet/ti/netcp_core.c:2084:17: note: in expansion of macro 'dev_err' 2084 | dev_err(dev, "tx-pool size too small, must be at least %d\n", | ^~~~~~~ drivers/net/ethernet/ti/netcp_core.c:2084:73: note: format string is defined here 2084 | dev_err(dev, "tx-pool size too small, must be at least %d\n", | ~^ | | | int | %ld cc1: all warnings being treated as errors The commit this patch is fixing is only in net-next and my patch to fix this warning is already applied: https://git.kernel.org/netdev/net-next/c/3292004c90c8 c5b959eeb7f9 should be reverted in net (I am running out of time today otherwise I would just send a patch). Cheers, Nathan
On Fri, 31 Mar 2023 14:44:44 -0700 Nathan Chancellor wrote: > The commit this patch is fixing is only in net-next and my patch to fix > this warning is already applied: > > https://git.kernel.org/netdev/net-next/c/3292004c90c8 > > c5b959eeb7f9 should be reverted in net (I am running out of time today > otherwise I would just send a patch). Sorry for the mix-up, cleaned up now.
From: Eric Dumazet > Sent: 31 March 2023 17:58 .... > > I'd personally define %MAX_SKB_FRAGS as `(u32)CONFIG_MAX_SKB_FRAGS`. > > It can't be below zero or above %U32_MAX and we have to define it > > manually anyway, so why not cast to the type expected from it :D > > > > Some files have the assumption MAX_SKB_FRAGS can be understood by the > C preprocessor. > > #if MAX_SKB_FRAGS > 32 ... You could use: #define MAX_SKB_FRAGS (CONFIG_MAX_SKB_FRAGS + 0u) to force the type to be 'unsigned int' while still leaving a value that cpp groks. (Or add 0ul to get the type back? to 'unsigned long'.) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c index 1bb596a9d8a2..dfdbcdeb991f 100644 --- a/drivers/net/ethernet/ti/netcp_core.c +++ b/drivers/net/ethernet/ti/netcp_core.c @@ -2081,7 +2081,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device, netcp->tx_pool_region_id = temp[1]; if (netcp->tx_pool_size < MAX_SKB_FRAGS) { - dev_err(dev, "tx-pool size too small, must be at least %ld\n", + dev_err(dev, "tx-pool size too small, must be at least %d\n", MAX_SKB_FRAGS); ret = -ENODEV; goto quit;