From: Greg KH <gregkh@linuxfoundation.org>
To: tuhaowen <tuhaowen@uniontech.com>
Cc: sudipm.mukherjee@gmail.com, alexander.deucher@amd.com,
linux-kernel@vger.kernel.org, huangbibo@uniontech.com,
wangyuli@uniontech.com
Subject: Re: [PATCH] dev/parport: fix the array out-of-bounds risk
Date: Thu, 4 Jul 2024 12:07:47 +0200 [thread overview]
Message-ID: <2024070413-obsessive-stack-7c62@gregkh> (raw)
In-Reply-To: <20240626021136.12282-1-tuhaowen@uniontech.com>
On Wed, Jun 26, 2024 at 10:11:36AM +0800, tuhaowen wrote:
> The array buffer size is 20 bytes.
> When executing code in a 64-bit CPU environment, up to 42 bytes of
> data will be written into this array
> (the size of "%lu\t%lu\n" is 20 + 1 + 20 + 1).
>
> In fact, this line of code for 32-bit CPUs also has the risk of
> crossing the boundary, but it can exceed 2 bytes at most. With good
> luck, it is local variables that are damaged, and there are no serious
> consequences.
Usually because no one actually has this hardware anymore :)
Can you also properly test the buffer size when writing into it so that
even if the math is incorrect, it will not overflow?
thanks,
greg k-h
next prev parent reply other threads:[~2024-07-04 10:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 2:11 [PATCH] dev/parport: fix the array out-of-bounds risk tuhaowen
2024-07-04 10:07 ` Greg KH [this message]
2024-07-05 6:36 ` tuhaowen
2024-07-05 6:45 ` Greg KH
2024-07-05 8:58 ` tuhaowen
2024-07-05 9:42 ` Greg KH
2024-07-08 2:33 ` tuhaowen
2024-07-08 7:18 ` Greg KH
2024-07-08 8:04 ` [PATCH v2] " tuhaowen
-- strict thread matches above, loose matches on Subject: below --
2024-05-27 7:23 [PATCH] " tuhaowen
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=2024070413-obsessive-stack-7c62@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=alexander.deucher@amd.com \
--cc=huangbibo@uniontech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.com \
--cc=tuhaowen@uniontech.com \
--cc=wangyuli@uniontech.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.