From: "yukuai (C)" <yukuai3@huawei.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <laforge@gnumonks.org>, <arnd@arndb.de>, <akpm@osdl.org>,
<linux-kernel@vger.kernel.org>, <yi.zhang@huawei.com>
Subject: Re: [PATCH] char: pcmcia: fix possible array index out of bounds in set_protocol()
Date: Fri, 21 May 2021 19:34:52 +0800 [thread overview]
Message-ID: <23af0838-07c3-7113-4229-28cc82b07527@huawei.com> (raw)
In-Reply-To: <YKeSdYJiVMO9NKV4@kroah.com>
On 2021/05/21 18:59, Greg KH wrote:
> On Fri, May 21, 2021 at 06:07:05PM +0800, Yu Kuai wrote:
>> The length of array 'pts_reply' is 4, and the loop in set_protocol()
>> will access array element from 0 to num_bytes_read - 1. Thus if
>> io_read_num_rec_bytes() gets 'num_bytes_read' more than 4, it will
>> cause index out of bounds errors.
>
> And how can num_bytes_read be greater than 4?
Hi
Do you mean num_bytes_read here should never be greater than 4?
544 io_read_num_rec_bytes(iobase, &num_bytes_read);
545 if (num_bytes_read >= 4) {
546 DEBUGP(2, dev, "NumRecBytes = %i\n",
num_bytes_read);
547 break;
>
> Ah, it is tested, but you might want to error out if that happens, as
> obviously something went wrong.
>
> Do you have this hardware to test these changes?
Sorry we don't have this hardware...
Thanks,
Yu Kuai
>
> thanks,
>
> greg k-h
> .
>
next prev parent reply other threads:[~2021-05-21 11:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 10:07 [PATCH] char: pcmcia: fix possible array index out of bounds in set_protocol() Yu Kuai
2021-05-21 10:59 ` Greg KH
2021-05-21 11:34 ` yukuai (C) [this message]
2021-05-21 11:42 ` Greg KH
2021-05-21 12:06 ` [PATCH V2] char: pcmcia: error out if 'num_bytes_read' is greater than 4 " Yu Kuai
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=23af0838-07c3-7113-4229-28cc82b07527@huawei.com \
--to=yukuai3@huawei.com \
--cc=akpm@osdl.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yi.zhang@huawei.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).