From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A9A3CA9EB9 for ; Sat, 26 Oct 2019 13:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1A6B206DD for ; Sat, 26 Oct 2019 13:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096436; bh=MOYuMSe5m+xPdrBUrgqNDECPFxtnpuMy0BGF0ZkhL74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ypcXqUYYmEa7Y7Tw3wucF4LMPNm507RHMfEm25rbgUJ+k/JZS38CWcUM7/QFWFNUD i6GITVInOiYhmC4RHSvF9H6MIqoP8wp7iq1FTWqhhOSSY9xoTC1BR88I9gP0qbBeSY u2gYiMfCMNFlWcfN4O1kWGxXfwclcSIgxNUx6ADU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729592AbfJZN1O (ORCPT ); Sat, 26 Oct 2019 09:27:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:43420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729080AbfJZNVj (ORCPT ); Sat, 26 Oct 2019 09:21:39 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 26D86214DA; Sat, 26 Oct 2019 13:21:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572096098; bh=MOYuMSe5m+xPdrBUrgqNDECPFxtnpuMy0BGF0ZkhL74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BP+9rcmUGOUUSJ/hGjCntiPwIEn+IbBglADrdzXW20iRhf36rLYsmc19vvL4pnttq e2XU06Qb+YvMw5y5lWlHxeuo+6UBTwC7ypdi4aSA0vpk8Q8xE1JbiuNWEcNQSbh7nB zyom1wkf5qG6s1wVsGJDHAG76krtsprY3WKLIEmY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Antonio Borneo , Jakub Kicinski , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 14/33] net: stmmac: fix length of PTP clock's name string Date: Sat, 26 Oct 2019 09:20:51 -0400 Message-Id: <20191026132110.4026-14-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191026132110.4026-1-sashal@kernel.org> References: <20191026132110.4026-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Antonio Borneo [ 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 Fixes: 92ba6888510c ("stmmac: add the support for PTP hw clock driver") Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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 e471a903c6543..1c1d6a9428229 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -154,7 +154,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp, /* structure describing a PTP hardware clock */ static const 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