* [PATCH] net: txgbe: clean up PBA string
@ 2023-10-16 9:48 Jiawen Wu
2023-10-16 19:19 ` Andrew Lunn
0 siblings, 1 reply; 3+ messages in thread
From: Jiawen Wu @ 2023-10-16 9:48 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, netdev; +Cc: mengyuanlou, Jiawen Wu
Replace deprecated strncpy with strscpy, and add the missing PBA prints.
This issue is reported by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/netdev/002101d9ffdd$9ea59f90$dbf0deb0$@trustnetic.com/T/#t
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
index 394f699c51da..123e3ca78ef0 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
@@ -741,8 +741,9 @@ static int txgbe_probe(struct pci_dev *pdev,
/* First try to read PBA as a string */
err = txgbe_read_pba_string(wx, part_str, TXGBE_PBANUM_LENGTH);
if (err)
- strncpy(part_str, "Unknown", TXGBE_PBANUM_LENGTH);
+ strscpy(part_str, "Unknown", sizeof(part_str));
+ netif_info(wx, probe, netdev, "PBA No: %s\n", part_str);
netif_info(wx, probe, netdev, "%pM\n", netdev->dev_addr);
return 0;
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: txgbe: clean up PBA string
2023-10-16 9:48 [PATCH] net: txgbe: clean up PBA string Jiawen Wu
@ 2023-10-16 19:19 ` Andrew Lunn
2023-10-17 6:55 ` Jiawen Wu
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2023-10-16 19:19 UTC (permalink / raw)
To: Jiawen Wu; +Cc: davem, edumazet, kuba, pabeni, netdev, mengyuanlou
On Mon, Oct 16, 2023 at 05:48:31PM +0800, Jiawen Wu wrote:
> Replace deprecated strncpy with strscpy, and add the missing PBA prints.
>
> This issue is reported by: Justin Stitt <justinstitt@google.com>
> Link: https://lore.kernel.org/netdev/002101d9ffdd$9ea59f90$dbf0deb0$@trustnetic.com/T/#t
>
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
> drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> index 394f699c51da..123e3ca78ef0 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> @@ -741,8 +741,9 @@ static int txgbe_probe(struct pci_dev *pdev,
> /* First try to read PBA as a string */
> err = txgbe_read_pba_string(wx, part_str, TXGBE_PBANUM_LENGTH);
> if (err)
> - strncpy(part_str, "Unknown", TXGBE_PBANUM_LENGTH);
> + strscpy(part_str, "Unknown", sizeof(part_str));
>
> + netif_info(wx, probe, netdev, "PBA No: %s\n", part_str);
> netif_info(wx, probe, netdev, "%pM\n", netdev->dev_addr);
In general, we try not to spam the kernel log, especially not for the
good case. You can get the MAC address with ip link show. How
important is the part? Can you get the same information from lspci?
Or maybe you could append it to the driver name in wx_get_drvinfo()?
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] net: txgbe: clean up PBA string
2023-10-16 19:19 ` Andrew Lunn
@ 2023-10-17 6:55 ` Jiawen Wu
0 siblings, 0 replies; 3+ messages in thread
From: Jiawen Wu @ 2023-10-17 6:55 UTC (permalink / raw)
To: 'Andrew Lunn'; +Cc: davem, edumazet, kuba, pabeni, netdev, mengyuanlou
On Tuesday, October 17, 2023 3:19 AM, Andrew Lunn wrote:
> On Mon, Oct 16, 2023 at 05:48:31PM +0800, Jiawen Wu wrote:
> > Replace deprecated strncpy with strscpy, and add the missing PBA prints.
> >
> > This issue is reported by: Justin Stitt <justinstitt@google.com>
> > Link: https://lore.kernel.org/netdev/002101d9ffdd$9ea59f90$dbf0deb0$@trustnetic.com/T/#t
> >
> > Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> > ---
> > drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > index 394f699c51da..123e3ca78ef0 100644
> > --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > @@ -741,8 +741,9 @@ static int txgbe_probe(struct pci_dev *pdev,
> > /* First try to read PBA as a string */
> > err = txgbe_read_pba_string(wx, part_str, TXGBE_PBANUM_LENGTH);
> > if (err)
> > - strncpy(part_str, "Unknown", TXGBE_PBANUM_LENGTH);
> > + strscpy(part_str, "Unknown", sizeof(part_str));
> >
> > + netif_info(wx, probe, netdev, "PBA No: %s\n", part_str);
> > netif_info(wx, probe, netdev, "%pM\n", netdev->dev_addr);
>
> In general, we try not to spam the kernel log, especially not for the
> good case. You can get the MAC address with ip link show. How
> important is the part? Can you get the same information from lspci?
> Or maybe you could append it to the driver name in wx_get_drvinfo()?
PBA info can be read from lspci, also the log for MAC address can be removed.
I'll submit a patch to clean them up in txgbe/ngbe.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-17 6:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-16 9:48 [PATCH] net: txgbe: clean up PBA string Jiawen Wu
2023-10-16 19:19 ` Andrew Lunn
2023-10-17 6:55 ` Jiawen Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).