mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: Edward Adam Davis <eadavis@qq.com>,
	syzbot+07762f019fd03d01f04c@syzkaller.appspotmail.com,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com,
	Dan Carpenter <error27@gmail.com>
Subject: Re: [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup
Date: Fri, 31 May 2024 11:53:29 +0300	[thread overview]
Message-ID: <b86a9ef9-ea50-45e1-85b6-20b6f5358862@moroto.mountain> (raw)
In-Reply-To: <a66819c1-1ee1-47e1-8831-c0f1a22a12c9@oracle.com>

On Thu, May 30, 2024 at 08:16:59PM +0530, Harshit Mogalapalli wrote:
> > diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
> > index a90ed2ceae84..9f0e09f667b1 100644
> > --- a/drivers/hid/usbhid/hid-core.c
> > +++ b/drivers/hid/usbhid/hid-core.c
> > @@ -1029,7 +1029,7 @@ static int usbhid_parse(struct hid_device *hid)
> >   		return -EINVAL;
> >   	}
> > -	rdesc = kmalloc(rsize, GFP_KERNEL);
> > +	rdesc = kzalloc(rsize, GFP_KERNEL);

This kzalloc() is unnecessary because hid_get_class_descriptor() has
a memset() built in:

	memset(buf, 0, size);

I'm not a huge fan of how if hid_get_class_descriptor() runs out of
retries, we return the number of bytes in a partial read.  Then the
caller pretends it was a success instead of using the result.  But
that's a different issue.

regards,
dan carpenter


      reply	other threads:[~2024-05-31  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-24 20:00 syzbot
2024-05-28  5:05 ` [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds Andrew Ballance
2024-05-28  5:46   ` [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup syzbot
2024-05-31  8:59   ` [PATCH] hid: asus: asus_report_fixup: fix potential read out of bounds Dan Carpenter
2024-06-02  8:50     ` [PATCH v2] " Andrew Ballance
2024-06-02 10:57       ` Greg KH
2024-06-06  8:31       ` Benjamin Tissoires
2024-05-28 12:28 ` [syzbot] [input?] [usb?] KMSAN: uninit-value in asus_report_fixup Edward Adam Davis
2024-05-28 16:05   ` syzbot
2024-05-30 14:46   ` Harshit Mogalapalli
2024-05-31  8:53     ` Dan Carpenter [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=b86a9ef9-ea50-45e1-85b6-20b6f5358862@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=eadavis@qq.com \
    --cc=error27@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+07762f019fd03d01f04c@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®