driver core: platform: Prevent resouce overflow from causing infinite loops
authorSimon Schwartz <kern.simon@theschwartz.xyz>
Tue, 10 Dec 2019 22:41:37 +0000 (17:41 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Feb 2020 14:42:32 +0000 (15:42 +0100)
commit34b95aa12c3fe91ce2112cd853194371ffbe41e1
tree99ee9ffb2da921ee2540217e9ffc6656d0d1170c
parentad4a9f686c02cb846a30340e53b650069656191b
driver core: platform: Prevent resouce overflow from causing infinite loops

[ Upstream commit 39cc539f90d035a293240c9443af50be55ee81b8 ]

num_resources in the platform_device struct is declared as a u32.  The
for loops that iterate over num_resources use an int as the counter,
which can cause infinite loops on architectures with smaller ints.
Change the loop counters to u32.

Signed-off-by: Simon Schwartz <kern.simon@theschwartz.xyz>
Link: https://lore.kernel.org/r/2201ce63a2a171ffd2ed14e867875316efcf71db.camel@theschwartz.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/platform.c