From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: andriy.shevchenko@linux.intel.com, kees@kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] Input: penmount: bound packet buffer indices in IRQ path
Date: Tue, 24 Mar 2026 18:36:29 -0700 [thread overview]
Message-ID: <acM7X47UDx_yYNJ1@google.com> (raw)
In-Reply-To: <20260324131442.27632-1-pengpeng@iscas.ac.cn>
Hi Pengpeng,
On Tue, Mar 24, 2026 at 09:14:42PM +0800, Pengpeng Hou wrote:
> pm_interrupt() stores each incoming byte into pm->data[] before the
> packet parser gets a chance to reset pm->idx. If the incoming serial
> stream never matches one of the expected packet headers, pm->idx can
> advance past the fixed receive buffer and the next IRQ will write beyond
> PM_MAX_LENGTH.
How will it advance? The handlers do:
if (byte_0_check() && pm->packetsize == ++pm->idx)
...
If we never match any of the protocols then pm->idx will never advance
past 0 (and we will keep overwriting the first byte of the packet
array).
Does your analyzer miss the "short-circuiting" nature of && operator?
Thanks.
--
Dmitry
next prev parent reply other threads:[~2026-03-25 1:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 12:17 [PATCH] Input: penmount: bound packet buffer indices in IRQ path Pengpeng Hou
2026-03-23 13:32 ` Andy Shevchenko
2026-03-24 2:29 ` Pengpeng Hou
2026-03-24 12:11 ` Andy Shevchenko
2026-03-24 13:14 ` [PATCH v2] " Pengpeng Hou
2026-03-24 13:47 ` Andy Shevchenko
2026-03-25 1:36 ` Dmitry Torokhov [this message]
2026-03-25 1:46 ` Pengpeng Hou
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=acM7X47UDx_yYNJ1@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=kees@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pengpeng@iscas.ac.cn \
/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