From: Luis Chamberlain <mcgrof@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Russ Weight <russell.h.weight@intel.com>,
Tianfei zhang <tianfei.zhang@intel.com>,
Lee Jones <lee.jones@linaro.org>,
Shawn Guo <shawn.guo@linaro.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v3] test_firmware: fix end of loop test in upload_read_show()
Date: Mon, 9 May 2022 15:37:39 -0700 [thread overview]
Message-ID: <YnmXs+QbA4PjMBCX@bombadil.infradead.org> (raw)
In-Reply-To: <YnTGU3UJOIA09I7e@kili>
On Fri, May 06, 2022 at 09:55:15AM +0300, Dan Carpenter wrote:
> If a list_for_each_entry() loop exits without hitting a break statement
> then the iterator points to invalid memory. So in this code the
> "tst->name" dereference is an out bounds read. It's an offset from the
> &test_upload_list pointer and it will likely work fine most of the time
> but it's not correct.
>
> One alternative is to fix this this by changing the test to:
>
> if (list_entry_is_head(tst, &test_upload_list, node)) {
>
> But the simpler, trendy new way is just create a new variable and test
> for NULL.
>
> Fixes: a31ad463b72d ("test_firmware: Add test support for firmware upload")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reviewed-by: Russ Weight <russell.h.weight@intel.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
prev parent reply other threads:[~2022-05-09 22:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 6:55 Dan Carpenter
2022-05-09 22:37 ` Luis Chamberlain [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=YnmXs+QbA4PjMBCX@bombadil.infradead.org \
--to=mcgrof@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=russell.h.weight@intel.com \
--cc=shawn.guo@linaro.org \
--cc=tianfei.zhang@intel.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®