* [char-misc:char-misc-testing 27/30] drivers/android/binder_alloc.c:355:9: warning: Variable 'n' is reassigned a value before the old one has been used.
@ 2020-09-07 12:40 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-09-07 12:40 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4849 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Martijn Coenen <maco@android.com>
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-testing
head: ab04de8ec235ab03573e7ef33b21c357ba248b5f
commit: 261e7818f06ec51e488e007f787ccd7e77272918 [27/30] binder: print warnings when detecting oneway spamming.
:::::: branch date: 4 hours ago
:::::: commit date: 4 days ago
compiler: sparc64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> drivers/android/binder_alloc.c:355:9: warning: Variable 'n' is reassigned a value before the old one has been used. [redundantAssignment]
for (n = rb_first(&alloc->allocated_buffers); n != NULL;
^
drivers/android/binder_alloc.c:350:0: note: Variable 'n' is reassigned a value before the old one has been used.
struct rb_node *n = alloc->free_buffers.rb_node;
^
drivers/android/binder_alloc.c:355:9: note: Variable 'n' is reassigned a value before the old one has been used.
for (n = rb_first(&alloc->allocated_buffers); n != NULL;
^
# https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?id=261e7818f06ec51e488e007f787ccd7e77272918
git remote add char-misc https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git fetch --no-tags char-misc char-misc-testing
git checkout 261e7818f06ec51e488e007f787ccd7e77272918
vim +/n +355 drivers/android/binder_alloc.c
da1b9564e85b1d Minchan Kim 2018-08-23 340
261e7818f06ec5 Martijn Coenen 2020-08-21 341 static void debug_low_async_space_locked(struct binder_alloc *alloc, int pid)
261e7818f06ec5 Martijn Coenen 2020-08-21 342 {
261e7818f06ec5 Martijn Coenen 2020-08-21 343 /*
261e7818f06ec5 Martijn Coenen 2020-08-21 344 * Find the amount and size of buffers allocated by the current caller;
261e7818f06ec5 Martijn Coenen 2020-08-21 345 * The idea is that once we cross the threshold, whoever is responsible
261e7818f06ec5 Martijn Coenen 2020-08-21 346 * for the low async space is likely to try to send another async txn,
261e7818f06ec5 Martijn Coenen 2020-08-21 347 * and at some point we'll catch them in the act. This is more efficient
261e7818f06ec5 Martijn Coenen 2020-08-21 348 * than keeping a map per pid.
261e7818f06ec5 Martijn Coenen 2020-08-21 349 */
261e7818f06ec5 Martijn Coenen 2020-08-21 350 struct rb_node *n = alloc->free_buffers.rb_node;
261e7818f06ec5 Martijn Coenen 2020-08-21 351 struct binder_buffer *buffer;
261e7818f06ec5 Martijn Coenen 2020-08-21 352 size_t total_alloc_size = 0;
261e7818f06ec5 Martijn Coenen 2020-08-21 353 size_t num_buffers = 0;
261e7818f06ec5 Martijn Coenen 2020-08-21 354
261e7818f06ec5 Martijn Coenen 2020-08-21 @355 for (n = rb_first(&alloc->allocated_buffers); n != NULL;
261e7818f06ec5 Martijn Coenen 2020-08-21 356 n = rb_next(n)) {
261e7818f06ec5 Martijn Coenen 2020-08-21 357 buffer = rb_entry(n, struct binder_buffer, rb_node);
261e7818f06ec5 Martijn Coenen 2020-08-21 358 if (buffer->pid != pid)
261e7818f06ec5 Martijn Coenen 2020-08-21 359 continue;
261e7818f06ec5 Martijn Coenen 2020-08-21 360 if (!buffer->async_transaction)
261e7818f06ec5 Martijn Coenen 2020-08-21 361 continue;
261e7818f06ec5 Martijn Coenen 2020-08-21 362 total_alloc_size += binder_alloc_buffer_size(alloc, buffer)
261e7818f06ec5 Martijn Coenen 2020-08-21 363 + sizeof(struct binder_buffer);
261e7818f06ec5 Martijn Coenen 2020-08-21 364 num_buffers++;
261e7818f06ec5 Martijn Coenen 2020-08-21 365 }
261e7818f06ec5 Martijn Coenen 2020-08-21 366
261e7818f06ec5 Martijn Coenen 2020-08-21 367 /*
261e7818f06ec5 Martijn Coenen 2020-08-21 368 * Warn if this pid has more than 50 transactions, or more than 50% of
261e7818f06ec5 Martijn Coenen 2020-08-21 369 * async space (which is 25% of total buffer size).
261e7818f06ec5 Martijn Coenen 2020-08-21 370 */
261e7818f06ec5 Martijn Coenen 2020-08-21 371 if (num_buffers > 50 || total_alloc_size > alloc->buffer_size / 4) {
261e7818f06ec5 Martijn Coenen 2020-08-21 372 binder_alloc_debug(BINDER_DEBUG_USER_ERROR,
261e7818f06ec5 Martijn Coenen 2020-08-21 373 "%d: pid %d spamming oneway? %zd buffers allocated for a total size of %zd\n",
261e7818f06ec5 Martijn Coenen 2020-08-21 374 alloc->pid, pid, num_buffers, total_alloc_size);
261e7818f06ec5 Martijn Coenen 2020-08-21 375 }
261e7818f06ec5 Martijn Coenen 2020-08-21 376 }
261e7818f06ec5 Martijn Coenen 2020-08-21 377
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-07 12:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-07 12:40 [char-misc:char-misc-testing 27/30] drivers/android/binder_alloc.c:355:9: warning: Variable 'n' is reassigned a value before the old one has been used kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.