mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominique Martinet via B4 Relay <devnull+asmadeus.codewreck.org@kernel.org>
To: "Randall P. Embry" <rpembry@gmail.com>,
	 Eric Van Hensbergen <ericvh@kernel.org>,
	 Latchesar Ionkov <lucho@ionkov.net>,
	 Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
	 Dominique Martinet <asmadeus@codewreck.org>
Subject: [PATCH 2/3] 9p: fix /sys/fs/9p/caches overwriting itself
Date: Fri, 26 Sep 2025 18:27:30 +0900	[thread overview]
Message-ID: <20250926-v9fs_misc-v1-2-a8b3907fc04d@codewreck.org> (raw)
In-Reply-To: <20250926-v9fs_misc-v1-0-a8b3907fc04d@codewreck.org>

From: "Randall P. Embry" <rpembry@gmail.com>

caches_show() overwrote its buffer on each iteration,
so only the last cache tag was visible in sysfs output.

Properly append with snprintf(buf + count, …).

Signed-off-by: Randall P. Embry <rpembry@gmail.com>
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
---
 fs/9p/v9fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 01e70a464b6039231df272e43b4ebdd3b5afb967..4d289c56578fb15e45d8e94a264977898973cb31 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -560,7 +560,7 @@ static ssize_t caches_show(struct kobject *kobj,
 	spin_lock(&v9fs_sessionlist_lock);
 	list_for_each_entry(v9ses, &v9fs_sessionlist, slist) {
 		if (v9ses->cachetag) {
-			n = snprintf(buf, limit, "%s\n", v9ses->cachetag);
+			n = snprintf(buf + count, limit, "%s\n", v9ses->cachetag);
 			if (n < 0) {
 				count = n;
 				break;

-- 
2.51.0



  parent reply	other threads:[~2025-09-26  9:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-26  9:27 [PATCH 0/3] Split patches sent earlier Dominique Martinet via B4 Relay
2025-09-26  9:27 ` [PATCH 1/3] 9p: clean up comment typos Dominique Martinet via B4 Relay
2025-09-26  9:27 ` Dominique Martinet via B4 Relay [this message]
2025-09-26  9:27 ` [PATCH 3/3] 9p: sysfs_init: don't hardcode error to ENOMEM Dominique Martinet via B4 Relay

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=20250926-v9fs_misc-v1-2-a8b3907fc04d@codewreck.org \
    --to=devnull+asmadeus.codewreck.org@kernel.org \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=rpembry@gmail.com \
    --cc=v9fs@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®