Den 29 jul 2014 04:40 skrev "Stephen Hemminger" <step...@networkplumber.org
>:
>
> On Sat, 26 Jul 2014 16:24:36 +0200
> Rickard Strandqvist <rickard_strandqv...@spectrumdigital.se> wrote:
>
> > Replacing strncpy with strlcpy to avoid strings that lacks null
terminate.
> >
> > Signed-off-by: Rickard Strandqvist <
rickard_strandqv...@spectrumdigital.se>
> > ---
>                            hw->mac.type, hw->phy.type, hw->phy.sfp_type,
>
> This patch doesn't change anything.
> Netdev is already zeroed when allocated therefore doing strncpy()
guarantees
> it will be null terminated.

Hi Stephen

It's not clear that alloc_etherdev_mq() will zero the memory area:

http://www.filewatcher.com/p/kernel-doc-2.6.32-71.14.1.el6.centos.plus.noarch.rpm.8821380/usr/share/man/man9/alloc_etherdev_mq.9.gz.html

If we are convinced that this is done, it works whith strncpy and sizeof()
- 1

But on the next with "part_str" I can not see that it can not be created
without a trailing zero. Except of course "Unknown" is less than 11
characters, but if we think that way, you can go back to using strcpy.

BR
Rickard Strandqvist
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit 
http://communities.intel.com/community/wired

Reply via email to