From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [v2,1/1] ARM: orion5x: use mac_pton() helper
Date: Fri, 23 Feb 2018 00:34:57 +0100 [thread overview]
Message-ID: <20180222233457.GA6052@lunn.ch> (raw)
In-Reply-To: <bce65520-7f11-49f5-c806-59e508001321@the2masters.de>
> 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 <netdev@vger.kernel.org>.
Thanks
Andrew
next prev parent reply other threads:[~2018-02-22 23:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 14:12 [PATCH v2 1/1] ARM: orion5x: use mac_pton() helper Andy Shevchenko
2015-10-13 11:27 ` Detlef Vollmann
2015-10-15 7:51 ` Gregory CLEMENT
2018-02-22 17:45 ` [v2,1/1] " Stefan Hellermann
2018-02-22 21:42 ` Andrew Lunn
2018-02-22 23:18 ` Stefan Hellermann
2018-02-22 23:34 ` Andrew Lunn [this message]
2018-02-23 10:09 ` Andy Shevchenko
2018-02-23 15:01 ` Andrew Lunn
2018-02-23 15:18 ` Andy Shevchenko
2018-02-23 15:51 ` Andrew Lunn
2018-02-23 16:36 ` Stefan Hellermann
2018-02-23 16:57 ` Andy Shevchenko
2018-02-23 17:23 ` Andrew Lunn
2018-02-23 18:20 ` Alexey Dobriyan
2018-02-23 20:17 ` [PATCH] net: Allow mac_pton() to work on non-NULL terminated strings Stefan Hellermann
2018-02-23 20:17 ` Stefan Hellermann
2018-02-23 20:17 ` Stefan Hellermann
2018-02-23 20:27 ` Andrew Lunn
2018-02-23 20:27 ` Andrew Lunn
2018-02-23 20:27 ` Andrew Lunn
2018-02-23 20:41 ` Alexey Dobriyan
2018-02-23 20:41 ` Alexey Dobriyan
2018-02-23 20:41 ` Alexey Dobriyan
2018-02-23 20:51 ` Andy Shevchenko
2018-02-23 20:51 ` Andy Shevchenko
2018-02-23 20:51 ` Andy Shevchenko
2018-02-26 18:37 ` David Miller
2018-02-26 18:37 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180222233457.GA6052@lunn.ch \
--to=andrew@lunn.ch \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.