linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huang Shijie <sjhuang@iluvatar.ai>
To: <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>, <shijie8@gmail.com>,
	Huang Shijie <sjhuang@iluvatar.ai>
Subject: [PATCH] lib/genalloc: change return type to unsigned long for bitmap_set_ll
Date: Tue, 5 Jan 2021 11:16:44 +0800	[thread overview]
Message-ID: <20210105031644.2771-1-sjhuang@iluvatar.ai> (raw)

Just as bitmap_clear_ll(), change return type to unsigned long
for bitmap_set_ll to avoid the possible overflow in future.

Signed-off-by: Huang Shijie <sjhuang@iluvatar.ai>
---
 This patch is not a bug fix.
 I missed to change it in previous patch.

---
 lib/genalloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/genalloc.c b/lib/genalloc.c
index dab97bb69df6..5dcf9cdcbc46 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -81,7 +81,8 @@ static int clear_bits_ll(unsigned long *addr, unsigned long mask_to_clear)
  * users set the same bit, one user will return remain bits, otherwise
  * return 0.
  */
-static int bitmap_set_ll(unsigned long *map, unsigned long start, unsigned long nr)
+static unsigned long
+bitmap_set_ll(unsigned long *map, unsigned long start, unsigned long nr)
 {
 	unsigned long *p = map + BIT_WORD(start);
 	const unsigned long size = start + nr;
-- 
2.17.1


                 reply	other threads:[~2021-01-05  3:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210105031644.2771-1-sjhuang@iluvatar.ai \
    --to=sjhuang@iluvatar.ai \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shijie8@gmail.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).