mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Edward Adam Davis <eadavis@qq.com>,
	syzbot+3bbbade4e1a7ab45ca3b@syzkaller.appspotmail.com
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org, mail@mariuszachmann.de,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] hwmon: fill it with 0 when data size is insufficient
Date: Thu, 19 Jun 2025 09:54:39 -0700	[thread overview]
Message-ID: <8b737d87-a7e6-4a01-959e-d0b65b54eea9@roeck-us.net> (raw)
In-Reply-To: <tencent_5F7E6FB82C0D6CF49454E862ED32CFDC780A@qq.com>

On 6/19/25 06:37, Edward Adam Davis wrote:
> When the data size returned by the sensor is less than IN_BUFFER_SIZE,
> it is padded with 0.
> 

The subject is missing the affected driver, and I really very much prefer
actually validating the return data instead of just assuming that it is
ok to fill the buffer with 0. So I'll take Marius' patch instead.

On a side note, please don't send patches as reply to some other e-mail.
That only asks for it to get lost.

Thanks,
Guenter


> 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);


      reply	other threads:[~2025-06-19 16:54 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 ` [PATCH] hwmon: fill it with 0 when data size is insufficient Edward Adam Davis
2025-06-19 16:54   ` Guenter Roeck [this message]

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=8b737d87-a7e6-4a01-959e-d0b65b54eea9@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=eadavis@qq.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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®