Skip to content

Modify bitmap_set_value() to suppress compiler warning

Syed Nayyar Waris linux-arch linux-arm-kernel linux-gpio linux-pm lkml oe-kbuild-all 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v14 patches 4 repliesSuperseded

Changes in v2 from the cover letter

- [Patch 1/2]: Squashed earlier three patches into one.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bitmap: Modify bitmap_set_value() to check bitmap lengthdrivers/gpio/gpio-xilinx.c include/linux/bitmap.h lib/test_bitmap.c+29 -221 reply
2/2gpio: xilinx: Add extra check if sum of widths exceed 64drivers/gpio/gpio-xilinx.c+6 -00 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchWilliam Breathitt Gray
1/2A-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] Modify bitmap_set_value() to suppress compiler warning

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 2/2]? Is the conditional check needed, and also does returning -EINVAL look good?

Changes in v2:
- [Patch 1/2]: Squashed earlier three patches into one.

Syed Nayyar Waris (2):
bitmap: Modify bitmap_set_value() to check bitmap length
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

Signature · 7 lines
2.29.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel