From: Dan Carpenter <error27@gmail.com>
To: b43-dev@lists.infradead.org
Cc: "David S. Miller" <davem@davemloft.net>, linux-wireless@vger.kernel.org
Subject: [PATCH 2/3] wifi: b43legacy: debugfs: NUL terminate string in debugfs
Date: Thu, 1 Oct 2026 10:37:46 +0300 [thread overview]
Message-ID: <909ea7a88658b5e7c183bf0fda31687a91d73818.1790839793.git.error27@gmail.com> (raw)
In-Reply-To: <cover.1790839793.git.error27@gmail.com>
The "buf" buffer is PAGE_SIZE and allocated with kzalloc(). We store a
string from the user in it and then pass it to sscanf() in the write
functions such as tsf_write_file(). The buffer is only used to store a
number so we never come close to filling up the whole PAGE_SIZE. Reserve
the last character of the page for a NUL terminator.
This is debugfs so it's root only.
Fixes: 75388acd0cd8 ("[B43LEGACY]: add mac80211-based driver for legacy BCM43xx devices")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
drivers/net/wireless/broadcom/b43legacy/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/b43legacy/debugfs.c b/drivers/net/wireless/broadcom/b43legacy/debugfs.c
index a04d90d7307c..7ce8bcf12f0a 100644
--- a/drivers/net/wireless/broadcom/b43legacy/debugfs.c
+++ b/drivers/net/wireless/broadcom/b43legacy/debugfs.c
@@ -259,7 +259,7 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
if (!count)
return 0;
- if (count > PAGE_SIZE)
+ if (count >= PAGE_SIZE)
return -E2BIG;
dev = file->private_data;
if (!dev)
--
2.53.0
next prev parent reply other threads:[~2026-10-01 7:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 7:37 [PATCH 0/3] wifi: NULL terminate some user strings Dan Carpenter
2026-10-01 7:37 ` [PATCH 1/3] wifi: b43: don't pass unterminated string to sscanf() Dan Carpenter
2026-10-01 7:37 ` Dan Carpenter [this message]
2026-10-01 7:37 ` [PATCH 3/3] wifi: carl9170: NUL terminate string in debugfs Dan Carpenter
2026-10-01 17:58 ` Christian Lamparter
2026-10-01 18:31 ` Dan Carpenter
2026-10-03 22:49 ` Jeff Johnson
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=909ea7a88658b5e7c183bf0fda31687a91d73818.1790839793.git.error27@gmail.com \
--to=error27@gmail.com \
--cc=b43-dev@lists.infradead.org \
--cc=davem@davemloft.net \
--cc=linux-wireless@vger.kernel.org \
/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