Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4458584ybp; Mon, 7 Oct 2019 08:44:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzau9a11gdAePQlD4oxxQDYg7Vax5gVeXG4R7N3oeoqUPb60HaN9LUGhp+Zdzt0o4t5drKf X-Received: by 2002:a17:906:ecea:: with SMTP id qt10mr24309080ejb.23.1570463071099; Mon, 07 Oct 2019 08:44:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570463071; cv=none; d=google.com; s=arc-20160816; b=UNDGqR5dpL6lT7oWT9oRcwBve37lvxeTqimj0yBqbx9ekhNij5EmaNGc6FTP362Rua SJ/K0wIqvz2vBz+BrI6wxId36WZtqcKrOo5f+St1mA9zKGtlb7Or6narw8ON1KGW4U9w RTjP+c/HN3GSlrXyOlOAOkaxAMa7M+/OKXtgITzSWlzZssAw0BcN8R63Iz91Q7F2EGGj J4mQrzyFolkJnNBmglbzKtDDBjBXkX243dNUencc9ZJ7spxHx2WJjPMDglEEIZMmvvfU YBBdW+tpqfntis1nV5X1DfSr5CHGgDNlJBPKWRgwcJF+CS0ZUmslK9dYZ1JZ4rbB7Dli ARsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ReTHlJPNQvhA7U0eyVuMNI7w32wDf1uVhzd702GW9vY=; b=t2fu+rTb/S+zFrXkff+GlZ/PQz/rDlUaoKQ7od6JqXriVQ89zvD+9cJTTEurnJd7TN tKACvxtMyswZAAMrM28VsyzmUyNe3OASfGEKabeQ0ZA1qgCCwJwp+oZAvPi0Ok4pGse1 pLOI5fq0sVKL3lPrY2uE4TIkeawVaw2rMj6C+M+zZMYu0Mc/apdyP+oeoEzRvTQ6+g7U JcOBYd5urSMwFQb0gSXOWuQAAUZbZ9VCm0WnGRRgWemLXjZMCcBfEr8OhFGl9XPCpq8Q 9hpxXmt1Fofw+rYklZB+6ltF9Rxj7MgPrTjG5xkmLrM8EpqzA09xAdMPm3YMlyfSWrLN ztsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=Zl1yOXFv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si7607240ejp.378.2019.10.07.08.44.07; Mon, 07 Oct 2019 08:44:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=Zl1yOXFv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728851AbfJGPnh (ORCPT + 99 others); Mon, 7 Oct 2019 11:43:37 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:11170 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728553AbfJGPnf (ORCPT ); Mon, 7 Oct 2019 11:43:35 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x97FQoJE023881; Mon, 7 Oct 2019 17:43:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=STMicroelectronics; bh=ReTHlJPNQvhA7U0eyVuMNI7w32wDf1uVhzd702GW9vY=; b=Zl1yOXFvSAK3LOytktG9xjQwnYnz8mvSxygwpSQ7W3ORIgn2kfmVws4KatiAJ2GpG6yI BtglI4i7vmGxXfAOjz3BjcjV5sDoZrzsHxcpkr2ScW7DgIWAy+qI1eJFxmHuiRIc0Uwb QsXGnkZdeJQlMa+D2YL6KEY+7LJ4IPOGCTdrV8kYkDujj9H9HRKPv/mR0in5WmgBJKqE EEV8YsmACBHN717hxTz65IFg8XYx3BGrwdkYEt01LC3sYNVwJayGRAKGf6iTFcaLgt29 b+qiF8AirTTfYzB2XUiqZF3q3ivjIXBh/1mty1dTwr+xWXy+LfTnpwDHINjcNLfKZ61L wA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2vegaguhph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Oct 2019 17:43:19 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D763A100034; Mon, 7 Oct 2019 17:43:18 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag5node3.st.com [10.75.127.15]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8EF882B1E43; Mon, 7 Oct 2019 17:43:18 +0200 (CEST) Received: from localhost (10.75.127.48) by SFHDAG5NODE3.st.com (10.75.127.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 7 Oct 2019 17:43:18 +0200 From: Antonio Borneo To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , CC: Antonio Borneo , Maxime Coquelin , , , Subject: [PATCH] net: stmmac: fix length of PTP clock's name string Date: Mon, 7 Oct 2019 17:43:04 +0200 Message-ID: <20191007154306.95827-3-antonio.borneo@st.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191007154306.95827-1-antonio.borneo@st.com> References: <20191007154306.95827-1-antonio.borneo@st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG5NODE3.st.com (10.75.127.15) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-07_03:2019-10-07,2019-10-07 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") --- 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 173493db038c..df638b18b72c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -164,7 +164,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.23.0