linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Antonio Borneo <antonio.borneo@st.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 4.4 146/174] net: stmmac: fix length of PTP clock's name string
Date: Thu, 16 Jan 2020 12:42:23 -0500	[thread overview]
Message-ID: <20200116174251.24326-146-sashal@kernel.org> (raw)
In-Reply-To: <20200116174251.24326-1-sashal@kernel.org>

From: Antonio Borneo <antonio.borneo@st.com>

[ Upstream commit 5da202c88f8c355ad79bc2e8eb582e6d433060e7 ]

The field "name" in struct ptp_clock_info has a fixed size of 16
chars and is used as zero terminated string by clock_name_show()
in drivers/ptp/ptp_sysfs.c
The current initialization value requires 17 chars to fit also the
null termination, and this causes overflow to the next bytes in
the struct when the string is read as null terminated:
	hexdump -C /sys/class/ptp/ptp0/clock_name
	00000000  73 74 6d 6d 61 63 5f 70  74 70 5f 63 6c 6f 63 6b  |stmmac_ptp_clock|
	00000010  a0 ac b9 03 0a                                    |.....|
where the extra 4 bytes (excluding the newline) after the string
represent the integer 0x03b9aca0 = 62500000 assigned to the field
"max_adj" that follows "name" in the same struct.

There is no strict requirement for the "name" content and in the
comment in ptp_clock_kernel.h it's reported it should just be 'A
short "friendly name" to identify the clock'.
Replace it with "stmmac ptp".

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Fixes: 92ba6888510c ("stmmac: add the support for PTP hw clock driver")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 170a18b61281..147c9f8cee7f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -157,7 +157,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
 /* structure describing a PTP hardware clock */
 static struct ptp_clock_info stmmac_ptp_clock_ops = {
 	.owner = THIS_MODULE,
-	.name = "stmmac_ptp_clock",
+	.name = "stmmac ptp",
 	.max_adj = 62500000,
 	.n_alarm = 0,
 	.n_ext_ts = 0,
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-01-16 18:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200116174251.24326-1-sashal@kernel.org>
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 022/174] clk: samsung: exynos4: fix refcount leak in exynos4_get_xom() Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 023/174] clk: imx6q: fix refcount leak in imx6q_clocks_init() Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 024/174] clk: imx6sx: fix refcount leak in imx6sx_clocks_init() Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 025/174] clk: imx7d: fix refcount leak in imx7d_clocks_init() Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 026/174] clk: vf610: fix refcount leak in vf610_clocks_init() Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 032/174] media: s5p-jpeg: Correct step and max values for V4L2_CID_JPEG_RESTART_INTERVAL Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 034/174] ASoC: imx-sgtl5000: put of nodes if finding codec fails Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 052/174] clocksource/drivers/sun5i: Fail gracefully when clock rate is unavailable Sasha Levin
2020-01-16 17:40 ` [PATCH AUTOSEL 4.4 053/174] ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used Sasha Levin
2020-01-16 17:41 ` [PATCH AUTOSEL 4.4 065/174] ARM: OMAP2+: Fix potentially uninitialized return value for _setup_reset() Sasha Levin
2020-01-16 17:41 ` [PATCH AUTOSEL 4.4 071/174] spi: bcm2835aux: fix driver to not allow 65535 (=-1) cs-gpios Sasha Levin
2020-01-16 17:41 ` [PATCH AUTOSEL 4.4 074/174] ARM: pxa: ssp: Fix "WARNING: invalid free of devm_ allocated data" Sasha Levin
2020-01-16 17:41 ` [PATCH AUTOSEL 4.4 090/174] ARM: riscpc: fix lack of keyboard interrupts after irq conversion Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 142/174] net: ethernet: stmmac: Fix signedness bug in ipq806x_gmac_of_parse() Sasha Levin
2020-01-16 17:42 ` Sasha Levin [this message]
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 149/174] dmaengine: imx-sdma: fix size check for sdma script_number Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 151/174] mt7601u: fix bbp version check in mt7601u_wait_bbp_ready Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 156/174] spi: atmel: fix handling of cs_change set on non-last xfer Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 159/174] clk: samsung: exynos5420: Preserve CPU clocks configuration during suspend/resume Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 161/174] media: exynos4-is: Fix recursive locking in isp_video_release() Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 165/174] tty: serial: imx: use the sg count from dma_map_sg Sasha Levin
2020-01-16 17:42 ` [PATCH AUTOSEL 4.4 173/174] arm64: dts: juno: Fix UART frequency Sasha Levin

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=20200116174251.24326-146-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=antonio.borneo@st.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.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 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).