Subject: [v2,1/1] ARM: orion5x: use mac_pton() helper

From: [email-masked] (Andy Shevchenko)
Date: Fri, 23 Feb 2018 12:09:33 +0200

On Fri, 2018-02-23 at 00:34 +0100, Andrew Lunn wrote:
> > But: On the 27th block is a large file (1,5kB) without 0 bytes
> > inside.
> > The code in qnap_tsx09_find_mac_addr() maps 1kB into memory (not a
> > whole
> > file or the whole 384kB) and then calls qnap_tsx09_check_mac_addr()
> > ->
> > mac_pton() -> strlen() on this memory block. as there is no 0 byte
> > in the
> > file on the 27th block, strlen runs into bad memory and the machine
> > panics.
> > The old code had no strlen().
> 
> Yes, that sounds look a good explanation. 
> 
> > I changed mac_pton() to use strnlen(), and now the panic is gone. I
> > don't
> > know why strlen is actually needed in mac_pton. The string is
> > checked in the
> > following loop, if there is a zero byte somewhere, the loop will be
> > returned
> > immediately. So I think the strlen() superfluous. Is the following
> > patch
> > correct?
> 
> The patch has been corrupted by you email client. But otherwise, yes.
> 
> Please take a look at:
> 
> https://www.kernel.org/doc/html/v4.12/process/submitting-patches.html
> 
> It will give you hits about correctly formatting the patch. In
> addition it should have:
> 
> Fixes: 4cd5773a2ae6 ("net: core: move mac_pton() to lib/net_utils.c")
> 
> before the --- line, to indicate what it is fixing.
> 
> This patch should be against
> git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git,
> since it is a fix, and sent to <[email-masked]>.

Guys, consider this one instead:
https://patchwork.ozlabs.org/patch/851008/

-- 
Andy Shevchenko <[email-masked]>
Intel Finland Oy