lkml.org 
[lkml]   [2020]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] mm/swapfile.c: count won't be bigger than SWAP_MAP_MAX
Date
When the condition is true, there are two possibilities:

1. count == SWAP_MAP_BAD
2. count == (SWAP_MAP_MAX & COUNT_CONTINUED) == SWAP_MAP_SHMEM

The first case would be filtered by the first if in __swap_duplicate().

And the second case means this swap entry is for shmem. Since we never
do another duplication for shmem swap entry. This won't happen neither.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
mm/swapfile.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 1a877d1d40e3..88dd2ad34aad 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3404,8 +3404,6 @@ static int __swap_duplicate(swp_entry_t entry, unsigned char usage)

if ((count & ~COUNT_CONTINUED) < SWAP_MAP_MAX)
count += usage;
- else if ((count & ~COUNT_CONTINUED) > SWAP_MAP_MAX)
- err = -EINVAL;
else if (swap_count_continued(p, offset, count))
count = COUNT_CONTINUED;
else
--
2.23.0
\
 
 \ /
  Last update: 2020-05-01 03:54    [W:1.379 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site