All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Modify bitmap_set_value() to suppress compiler warning
@ 2020-12-12  9:33 ` Syed Nayyar Waris
  0 siblings, 0 replies; 10+ messages in thread
From: Syed Nayyar Waris @ 2020-12-12  9:33 UTC (permalink / raw)
  To: linus.walleij, akpm
  Cc: andriy.shevchenko, vilhelm.gray, michal.simek, arnd, rrichter,
	linus.walleij, bgolaszewski, yamada.masahiro, rui.zhang,
	daniel.lezcano, amit.kucheria, linux-arch, linux-gpio,
	linux-kernel, linux-arm-kernel, linux-pm

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
-- 
2.29.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-13 14:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-12  9:33 [PATCH v2 0/2] Modify bitmap_set_value() to suppress compiler warning Syed Nayyar Waris
2020-12-12  9:33 ` Syed Nayyar Waris
2020-12-12  9:34 ` [PATCH v2 1/2] bitmap: Modify bitmap_set_value() to check bitmap length Syed Nayyar Waris
2020-12-12  9:34   ` Syed Nayyar Waris
2020-12-12 15:56   ` kernel test robot
2020-12-12 17:05   ` kernel test robot
2020-12-13 14:55   ` Andy Shevchenko
2020-12-13 14:55     ` Andy Shevchenko
2020-12-12  9:34 ` [PATCH v2 2/2] gpio: xilinx: Add extra check if sum of widths exceed 64 Syed Nayyar Waris
2020-12-12  9:34   ` Syed Nayyar Waris

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.