OSDN Git Service

ANDROID: proc: fix undefined behavior in proc_uid_base_readdir
authorConnor O'Brien <connoro@google.com>
Wed, 23 May 2018 20:00:23 +0000 (13:00 -0700)
committerAmit Pundir <amit.pundir@linaro.org>
Tue, 14 Aug 2018 12:17:11 +0000 (17:47 +0530)
commit37ae0f97dbb85f9476c4a7f3701e3468a0f379cb
treeb30ca63f813a0fa86dd8207c6e00e25c0aa90073
parent2fce1d443ac7457e45e22d25b81f6ffdbd0bb1d1
ANDROID: proc: fix undefined behavior in proc_uid_base_readdir

When uid_base_stuff has no entries, proc_uid_base_readdir tries to
compute an address before the start of the array. Revise this check to
use uid_base_stuff + nents instead, which makes the code valid
regardless of array size.

Bug: 80158484
Test: No more compiler warning with CONFIG_CPU_FREQ_TIMES=n
Change-Id: I6e55b27c3ba8210cee194f6d27bbd62c0b263796
Signed-off-by: Connor O'Brien <connoro@google.com>
fs/proc/uid.c