Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp631904pxj; Thu, 27 May 2021 08:14:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxEUC0Eu9+817dsyRC39/s++jLFNsPOdeG0qSuEygGDuDnWKxt2bmbgafUnmilxnkwY8vB X-Received: by 2002:a05:6638:34ac:: with SMTP id t44mr3834611jal.97.1622128484452; Thu, 27 May 2021 08:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622128484; cv=none; d=google.com; s=arc-20160816; b=K3v8+aSyR/kqkTYFOrGo3oWCpuFn0+DwE6462frOQstyg4dXO0rHEit3fCdwDU5BbO r8swR7F81/rvo4jPcSVcnssKZDQHQwzdM4Q4aKgyhnwxW/yTha+pn1bzthtqztAJV2H5 o6gzKimnrG7rp/6OfpBveFnuatxijcJK2ABxjXIlcqot3Mzby3n/1QMflzs+Y2jKzsJf Ho4CjCeHa+B61f6X1M/+neajk9HtNPn9h61mqtUV38m/WrJbo+RVlJuOnjZxQBOcSMIp XiNyPbBkf6ih5nMGiV+XLYkoJfCPtDIGKzQ/Sx+FWf/jUtA5Ksoho/G52bKl8R2/92L0 b6mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ud9VzerUepQstHiIoFBMM37rOwzObSvTiDkngmcdcG4=; b=XXrEwKBwkwoLkI8+/vWoYAPQ5EteotJMz7sRT6kj+6ML30/eJGQOH8dEBLInlbD1M+ bg7AI91fudtb/Vwzxdv8qPdduJCK6/CDap9H8/vk1Mk9A8AHLLQ4DIBbRvHv868RBnEs DZNKadWeCnXzhdcrnPn3+F8MLvXxT2xs07YaS1LggGnzOG8vxap8FSCQ4AcUxQGYQwiP 5heCQMxLF8hGq1Xj/BFN9HW0sZwv9gR2u7EkLwGk4H8pP3ItmvqlHV1LcO+WdNleCuiB gwI6MfCV6IedpIhRA57UV6aLyWgs2+SlFWWiJlu2+yous8GUIbG35+og0Vqx3mi/hvNF EtTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si2252282ilk.31.2021.05.27.08.14.31; Thu, 27 May 2021 08:14:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235538AbhE0JNC (ORCPT + 99 others); Thu, 27 May 2021 05:13:02 -0400 Received: from foss.arm.com ([217.140.110.172]:54480 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbhE0JNB (ORCPT ); Thu, 27 May 2021 05:13:01 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE2DD13A1; Thu, 27 May 2021 02:11:27 -0700 (PDT) Received: from e125579.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 045E63F73D; Thu, 27 May 2021 02:11:25 -0700 (PDT) From: Dietmar Eggemann To: Ingo Molnar , Peter Zijlstra Cc: Juri Lelli , Vincent Guittot , Steven Rostedt , Greg Kroah-Hartman , Valentin Schneider , linux-kernel@vger.kernel.org Subject: [PATCH] debugfs: Fix debugfs_read_file_str() Date: Thu, 27 May 2021 11:11:05 +0200 Message-Id: <20210527091105.258457-1-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Read the entire size of the buffer, including the trailing new line character. Discovered while reading the sched domain names of CPU0: before: cat /sys/kernel/debug/sched/domains/cpu0/domain*/name SMTMCDIE after: cat /sys/kernel/debug/sched/domains/cpu0/domain*/name SMT MC DIE Fixes: 9af0440ec86eb ("debugfs: Implement debugfs_create_str()") Signed-off-by: Dietmar Eggemann --- fs/debugfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c index e813acfaa6e8..ba7c01cd9a5d 100644 --- a/fs/debugfs/file.c +++ b/fs/debugfs/file.c @@ -893,7 +893,7 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf, copy[copy_len] = '\n'; - ret = simple_read_from_buffer(user_buf, count, ppos, copy, copy_len); + ret = simple_read_from_buffer(user_buf, count, ppos, copy, len); kfree(copy); return ret; -- 2.25.1