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>
Mon, 24 Feb 2020 07:36:47 +0000 (08:36 +0100)
commit3f6af05d1d1b76c4f81d259cc4aa0f5153919e91
tree89bc722e1b82a1e5713d0aca72451d8a82e48a8d
parent11c759264c329dba0dc74e74af577eb19e09ea63
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