lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201030185718.GA150073@rlk>
Date:   Sat, 31 Oct 2020 02:57:18 +0800
From:   Hui Su <sh_def@....com>
To:     akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] mm: define flags using bit numbers

These flag is meant the bit numbers, they are
used like '(type & SLOTS_CACHE)' and so on.

Define these flags using bit numbers instead of
hardcoding powers of 2, which maybe better.

No change in the actual values.

Signed-off-by: Hui Su <sh_def@....com>
---
 mm/swap_slots.c | 4 ++--
 mm/swapfile.c   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/swap_slots.c b/mm/swap_slots.c
index 0357fbe70645..18e7a01fd35c 100644
--- a/mm/swap_slots.c
+++ b/mm/swap_slots.c
@@ -47,8 +47,8 @@ static void deactivate_swap_slots_cache(void);
 static void reactivate_swap_slots_cache(void);
 
 #define use_swap_slot_cache (swap_slot_cache_active && swap_slot_cache_enabled)
-#define SLOTS_CACHE 0x1
-#define SLOTS_CACHE_RET 0x2
+#define SLOTS_CACHE		(1 << 0)
+#define SLOTS_CACHE_RET	(1 << 1)
 
 static void deactivate_swap_slots_cache(void)
 {
diff --git a/mm/swapfile.c b/mm/swapfile.c
index c4a613688a17..a0476c121c0e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -113,14 +113,14 @@ static inline unsigned char swap_count(unsigned char ent)
 }
 
 /* Reclaim the swap entry anyway if possible */
-#define TTRS_ANYWAY		0x1
+#define TTRS_ANYWAY		(1 << 0)
 /*
  * Reclaim the swap entry if there are no more mappings of the
  * corresponding page
  */
-#define TTRS_UNMAPPED		0x2
+#define TTRS_UNMAPPED		(1 << 1)
 /* Reclaim the swap entry if swap is getting full*/
-#define TTRS_FULL		0x4
+#define TTRS_FULL		(1 << 2)
 
 /* returns 1 if swap entry is freed */
 static int __try_to_reclaim_swap(struct swap_info_struct *si,
-- 
2.29.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ