diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-05-06 08:55:15 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-19 19:28:37 +0200 |
commit | 185b29c6151cf3a5c387ca5904c51c6af3292a0c (patch) | |
tree | d97d6e083194e19965af8a225b63ea69e8357f51 /fs | |
parent | driver core: location: Add "back" as a possible output for panel (diff) | |
download | linux-185b29c6151cf3a5c387ca5904c51c6af3292a0c.tar.xz linux-185b29c6151cf3a5c387ca5904c51c6af3292a0c.zip |
test_firmware: fix end of loop test in upload_read_show()
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")
Reviewed-by: Russ Weight <russell.h.weight@intel.com>
Acked-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/YnTGU3UJOIA09I7e@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions