lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 31 Mar 2023 17:08:28 +0200
From:   Alexander Lobakin <aleksander.lobakin@...el.com>
To:     Arnd Bergmann <arnd@...nel.org>, Jakub Kicinski <kuba@...nel.org>
CC:     Arnd Bergmann <arnd@...db.de>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>,
        "Nikolay Aleksandrov" <razor@...ckwall.org>,
        Jason Xing <kerneljasonxing@...il.com>,
        <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: netcp: MAX_SKB_FRAGS is now 'int'

From: Arnd Bergmann <arnd@...nel.org>
Date: Fri, 31 Mar 2023 09:48:56 +0200

> From: Arnd Bergmann <arnd@...db.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@...db.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ