Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1458408

[PATCHSET] kernfs, cgroup: make kernfs_path*() and cgroup_path*() behave in strlcpy() style

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject [PATCHSET] kernfs, cgroup: make kernfs_path*() and cgroup_path*() behave in strlcpy() style
Date Tue, 09 Aug 2016 07:30:01 +0200
Message-ID <s47LX-3fR-3@gated-at.bofh.it> (permalink)
X-Original-To gregkh@linuxfoundation.org, serge.hallyn@ubuntu.com
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=TLK9Es1OUn9xQF3a4wb0bRmM5m+RJQ9DbhC9JnHiUh8=; b=vUd6VerimHTpynLtvy5T73Jnm1XYyTSUnm70dBpd7p0DgfYY+nHUTQOy0Secd3PN1M 3+H1OyJk8j7TxLhB+3Cj1E+HVFe63HdwRSAF1bihUGlQTWHZ5ni3nrWxu4p3+pcsMNSz NajZ9HJSSJIFz8o0JAvHlZ/J/pW+ewRZSpvtMBeMWOrgidE/ijQs4RmnyVKnPF7YhaUq V7G9lEkJt1hQNT2uc4n1SAEwz2NICioLKsg8uG69i8i85EnD4zbQXSiL2fK0Otd+gCTF W1w6WQDWFWUk155mun3sbGL0jFS1dTmMOPKS61HQk0KNxeXrI9XoGwD8urF7skbyQd3+ OIrw==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=TLK9Es1OUn9xQF3a4wb0bRmM5m+RJQ9DbhC9JnHiUh8=; b=PKWZRA0SVZl8jpIhQSSSTRRV+g0AIb0fsnKrlc7l/lG8fDSeUrk13fYIKWj4LTZa23 bWoGzPNrTKcBKYibd3cBnhqH1rBq2Fi7VxJeYn1QSLj6tS2vYQ7mvX29PPnLYgi7Qv1j TrreiAjgb0omb8FFX7esnaRYg9hxeybckBK7uO5l+4W5APRX9gQ2RYgI1gAFVJkyXuXy MW0zvTVHjfQ4sn4HYEbIAstyhhjJujxaU8e9L9mEU3++KruG538luL5j75hDVEPuO7G/ wDhHrjcGIcuoi+wCN/LNT9wi43D1FnrX+6GCgHReHNjcaE3HmJdo3r2unbH4zvTqXLw6 ZWvw==
X-Gm-Message-State AEkoout+1vRf6Fps3nIZ0QUGzIhYUr5bYximah3VOJLd4JRC3qPHEWh4FjWEX7UW/J0ULA==
X-Received by 10.55.185.131 with SMTP id j125mr30857152qkf.138.1470720208594; Mon, 08 Aug 2016 22:23:28 -0700 (PDT)
X-Mailer git-send-email 2.7.4
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 35
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, kernel-team@fb.com, hannes@cmpxchg.org, lizefan@huawei.com
X-Original-Date Tue, 9 Aug 2016 01:23:20 -0400
X-Original-Message-ID <1470720204-4605-1-git-send-email-tj@kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1458408

Show key headers only | View raw


kernfs path formatting functions always return the length of full path
but the content of the output buffer is undefined when the length is
longer than the provided buffer.  Most cgroup path formatting
functions return the start of the output or NULL on errors including
overflow.  These inconsistent and rather peculiar behaviors developed
over time and make these functions unnecessarily difficult to use.
This patchset updates the formatting functions so that they all behave
in the style of strlcpy().

Greg, these changes are used by cgroup tracepoint additions and
shouldn't affect other users much.  Would it be okay to route these
through the cgroup tree?

 0001-kernfs-add-dummy-implementation-of-kernfs_path_from_.patch
 0002-kernfs-make-kernfs_path-behave-in-the-style-of-strlc.patch
 0003-kernfs-remove-kernfs_path_len.patch
 0004-cgroup-make-cgroup_path-and-friends-behave-in-the-st.patch

The patches are also available in the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-kernfs_path-strlcpy

diffstat follows.  Thanks.

 fs/kernfs/dir.c            |   84 +++++++++------------------------------------
 fs/sysfs/dir.c             |    6 +--
 include/linux/blk-cgroup.h |   11 -----
 include/linux/cgroup.h     |    9 ++--
 include/linux/kernfs.h     |   28 ++++++++++-----
 kernel/cgroup.c            |   48 +++++++++++--------------
 kernel/cpuset.c            |   12 +++---
 7 files changed, 73 insertions(+), 125 deletions(-)

--
tejun

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCHSET] kernfs, cgroup: make kernfs_path*() and cgroup_path*() behave in strlcpy() style Tejun Heo <tj@kernel.org> - 2016-08-09 07:30 +0200
  [PATCH 1/4] kernfs: add dummy implementation of kernfs_path_from_node() Tejun Heo <tj@kernel.org> - 2016-08-09 07:30 +0200
    [PATCH v2 1/4] kernfs: add dummy implementation of  kernfs_path_from_node() Tejun Heo <tj@kernel.org> - 2016-08-09 08:20 +0200
  [PATCH 3/4] kernfs: remove kernfs_path_len() Tejun Heo <tj@kernel.org> - 2016-08-09 07:30 +0200
  [PATCH 4/4] cgroup: make cgroup_path() and friends behave in the style of strlcpy() Tejun Heo <tj@kernel.org> - 2016-08-09 07:30 +0200
    [PATCH v2 4/4] cgroup: make cgroup_path() and friends behave in the  style of strlcpy() Tejun Heo <tj@kernel.org> - 2016-08-09 08:20 +0200
  Re: [PATCHSET] kernfs, cgroup: make kernfs_path*() and  cgroup_path*() behave in strlcpy() style Greg KH <gregkh@linuxfoundation.org> - 2016-08-09 10:40 +0200
    Re: [PATCHSET] kernfs, cgroup: make kernfs_path*() and  cgroup_path*() behave in strlcpy() style Tejun Heo <tj@kernel.org> - 2016-08-10 23:30 +0200

csiph-web