linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Syed Nayyar Waris <syednwaris@gmail.com>
To: akpm@linux-foundation.org
Cc: andriy.shevchenko@linux.intel.com, vilhelm.gray@gmail.com,
	michal.simek@xilinx.com, arnd@arndb.de, rrichter@marvell.com,
	linus.walleij@linaro.org, bgolaszewski@baylibre.com,
	yamada.masahiro@socionext.com, rui.zhang@intel.com,
	daniel.lezcano@linaro.org, amit.kucheria@verdurent.com,
	linux-arch@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Subject: [PATCH 0/4] Modify bitmap_set_value() to suppress compiler warning
Date: Fri, 20 Nov 2020 23:12:44 +0530	[thread overview]
Message-ID: <cover.1605893641.git.syednwaris@gmail.com> (raw)

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


             reply	other threads:[~2020-11-20 17:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 17:42 Syed Nayyar Waris [this message]
2020-11-20 18:43 ` [RESEND PATCH 1/4] bitmap: Modify bitmap_set_value() to check bitmap length Syed Nayyar Waris
2020-11-20 18:44 ` [RESEND PATCH 2/4] lib/test_bitmap.c: Modify for_each_set_clump test Syed Nayyar Waris
2020-11-20 18:45 ` [RESEND PATCH 3/4] gpio: xilinx: Modify bitmap_set_value() calls Syed Nayyar Waris
2020-12-01 15:33   ` Bartosz Golaszewski
2020-12-12  9:39     ` Syed Nayyar Waris
2020-11-20 18:46 ` [RESEND PATCH 4/4] gpio: xilinx: Add extra check if sum of widths exceed 64 Syed Nayyar Waris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1605893641.git.syednwaris@gmail.com \
    --to=syednwaris@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amit.kucheria@verdurent.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=rrichter@marvell.com \
    --cc=rui.zhang@intel.com \
    --cc=vilhelm.gray@gmail.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).