Thread (7 messages) 7 messages, 2 authors, 2020-12-12
STALE2054d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 0/4] Modify bitmap_set_value() to suppress compiler warning

From: Syed Nayyar Waris <hidden>
Date: 2020-11-20 17:43:18
Also in: linux-arch, linux-gpio, linux-pm, lkml

Hi All,

The purpose of this patchset is to suppress the compiler warning (-Wtype-limits).

In function bitmap_set_value(), add explicit check to see if the value being
written into the bitmap does not fall outside the bitmap.
The situation that it is falling outside is never possible in the code 
because the boundaries are required to be correct before the function is 
called. The responsibility is on the caller for ensuring the boundaries 
are correct.
The code change is simply to silence the GCC warning messages
because GCC is not aware that the boundaries have already been checked.
As such, we're better off using __builtin_unreachable() here because we
can avoid the latency of the conditional check entirely.

Michal,
What do you think of [PATCH 4/4]? Is the conditional check needed, and also whether
returning -EINVAL looks good?

Syed Nayyar Waris (4):
  bitmap: Modify bitmap_set_value() to check bitmap length
  lib/test_bitmap.c: Modify for_each_set_clump test
  gpio: xilinx: Modify bitmap_set_value() calls
  gpio: xilinx: Add extra check if sum of widths exceed 64

 drivers/gpio/gpio-xilinx.c | 18 ++++++++++++------
 include/linux/bitmap.h     | 35 +++++++++++++++++++++--------------
 lib/test_bitmap.c          |  4 ++--
 3 files changed, 35 insertions(+), 22 deletions(-)


base-commit: b640c4e12bbe1f0b6383c3ef788a89e5427c763f
-- 
2.29.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help