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>
Tue, 14 Jan 2020 15:14:47 +0000 (16:14 +0100)
commit39cc539f90d035a293240c9443af50be55ee81b8
tree9e0d2cb4dbf07616afecdc61f1f6e94f451944f7
parent5bf33f04eb5c3e6c55988046c88a5986430c7b4a
driver core: platform: Prevent resouce overflow from causing infinite loops

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>
drivers/base/platform.c