From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+3bbbade4e1a7ab45ca3b@syzkaller.appspotmail.com
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org, linux@roeck-us.net,
mail@mariuszachmann.de, syzkaller-bugs@googlegroups.com
Subject: [PATCH] hwmon: fill it with 0 when data size is insufficient
Date: Thu, 19 Jun 2025 21:37:43 +0800 [thread overview]
Message-ID: <tencent_5F7E6FB82C0D6CF49454E862ED32CFDC780A@qq.com> (raw)
In-Reply-To: <685392a0.050a0220.216029.0168.GAE@google.com>
When the data size returned by the sensor is less than IN_BUFFER_SIZE,
it is padded with 0.
Reported-by: syzbot+3bbbade4e1a7ab45ca3b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3bbbade4e1a7ab45ca3b
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
drivers/hwmon/corsair-cpro.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwmon/corsair-cpro.c b/drivers/hwmon/corsair-cpro.c
index e1a7f7aa7f80..274864e8a8e7 100644
--- a/drivers/hwmon/corsair-cpro.c
+++ b/drivers/hwmon/corsair-cpro.c
@@ -157,6 +157,8 @@ static int ccp_raw_event(struct hid_device *hdev, struct hid_report *report, u8
spin_lock(&ccp->wait_input_report_lock);
if (!completion_done(&ccp->wait_input_report)) {
memcpy(ccp->buffer, data, min(IN_BUFFER_SIZE, size));
+ if (size < IN_BUFFER_SIZE)
+ memset(ccp->buffer + size, 0, IN_BUFFER_SIZE - size);
complete_all(&ccp->wait_input_report);
}
spin_unlock(&ccp->wait_input_report_lock);
--
2.43.0
next prev parent reply other threads:[~2025-06-19 13:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-19 4:31 [syzbot] [hwmon?] KMSAN: uninit-value in get_temp_cnct syzbot
2025-06-19 5:56 ` Guenter Roeck
2025-06-19 8:01 ` Marius Zachmann
2025-06-19 13:01 ` Guenter Roeck
2025-06-19 13:37 ` Edward Adam Davis [this message]
2025-06-19 16:54 ` [PATCH] hwmon: fill it with 0 when data size is insufficient Guenter Roeck
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=tencent_5F7E6FB82C0D6CF49454E862ED32CFDC780A@qq.com \
--to=eadavis@qq.com \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mail@mariuszachmann.de \
--cc=syzbot+3bbbade4e1a7ab45ca3b@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/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®