]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/vmwgfx: Fix two list_for_each loop exit tests
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 26 Jun 2020 10:39:59 +0000 (13:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Aug 2020 11:07:40 +0000 (13:07 +0200)
commit64efb94072ae2e99da7886930c1321cf8d537f0f
tree9ee230c29dbefaf9b402b61ad9ca0a70b6b7e63e
parent9b2dca760333887efcab2b1a7023c5f1abcf770f
drm/vmwgfx: Fix two list_for_each loop exit tests

[ Upstream commit 4437c1152ce0e57ab8f401aa696ea6291cc07ab1 ]

These if statements are supposed to be true if we ended the
list_for_each_entry() loops without hitting a break statement but they
don't work.

In the first loop, we increment "i" after the "if (i == unit)" condition
so we don't necessarily know that "i" is not equal to unit at the end of
the loop.

In the second loop we exit when mode is not pointing to a valid
drm_display_mode struct so it doesn't make sense to check "mode->type".

Fixes: a278724aa23c ("drm/vmwgfx: Implement fbdev on kms v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c