Hi Stephen,

> -----Original Message-----
> From: Stephen Hemminger <[email protected]>
> Sent: Friday, November 11, 2022 12:22 AM
> To: Bing Zhao <[email protected]>
> Cc: Slava Ovsiienko <[email protected]>; Matan Azrad
> <[email protected]>; [email protected]; Raslan Darawsheh
> <[email protected]>; [email protected]
> Subject: Re: [PATCH] common/mlx5: fix the sysfs port name
> translation
> 
> External email: Use caution opening links or attachments
> 
> 
> On Thu, 10 Nov 2022 17:57:26 +0200
> Bing Zhao <[email protected]> wrote:
> 
> > With some OFED or upstream kernel of mlx5, the port name fetched
> from
> > "/sys/class/net/[DEV]/phys_port_name" may have a tailing "\n" as
> the
> > EOL. The sscanf() will return the scanned items number with this
> EOL.
> 
> Why not fix the DPDK driver to strip off the new line when the port
> name is read? The code in mlx5_os.c should do it there.

Thanks for your comments. Yes, IF_NAMESIZE is large enough to read all the 
characters including the newline into the buffer.
After fgets(), the strlen() or strchr() can be used to remove the tailing 
newline character.


BR. Bing

Reply via email to