[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YnmXs+QbA4PjMBCX@bombadil.infradead.org>
Date: Mon, 9 May 2022 15:37:39 -0700
From: Luis Chamberlain <mcgrof@...nel.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Russ Weight <russell.h.weight@...el.com>,
Tianfei zhang <tianfei.zhang@...el.com>,
Lee Jones <lee.jones@...aro.org>,
Shawn Guo <shawn.guo@...aro.org>, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH v3] test_firmware: fix end of loop test in
upload_read_show()
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@...cle.com>
> Reviewed-by: Russ Weight <russell.h.weight@...el.com>
Acked-by: Luis Chamberlain <mcgrof@...nel.org>
Luis
Powered by blists - more mailing lists