* [PATCH] mm: vmscan: fix get_swappiness() return value type
@ 2023-09-07 4:40 Zhiguo Jiang
2023-09-07 4:50 ` Matthew Wilcox
0 siblings, 1 reply; 2+ messages in thread
From: Zhiguo Jiang @ 2023-09-07 4:40 UTC (permalink / raw)
To: Andrew Morton, linux-mm, linux-kernel; +Cc: opensource.kernel, Zhiguo Jiang
Fix bool to int of the get_swappiness() return value type in
lruvec_is_sizable().
The get_swappiness() return value type is int, but the
get_swappiness() return value type is bool in lruvec_is_sizable().
So there is a possibility of value overflow.
Signed-off-by: Zhiguo Jiang <justinjiang@vivo.com>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
mode change 100644 => 100755 mm/vmscan.c
diff --git a/mm/vmscan.c b/mm/vmscan.c
index ea57a43ebd6b..f383e5b14598
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -4575,7 +4575,7 @@ static bool lruvec_is_sizable(struct lruvec *lruvec, struct scan_control *sc)
{
int gen, type, zone;
unsigned long total = 0;
- bool can_swap = get_swappiness(lruvec, sc);
+ int can_swap = get_swappiness(lruvec, sc);
struct lru_gen_folio *lrugen = &lruvec->lrugen;
struct mem_cgroup *memcg = lruvec_memcg(lruvec);
DEFINE_MAX_SEQ(lruvec);
--
2.39.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm: vmscan: fix get_swappiness() return value type
2023-09-07 4:40 [PATCH] mm: vmscan: fix get_swappiness() return value type Zhiguo Jiang
@ 2023-09-07 4:50 ` Matthew Wilcox
0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2023-09-07 4:50 UTC (permalink / raw)
To: Zhiguo Jiang; +Cc: Andrew Morton, linux-mm, linux-kernel, opensource.kernel
On Thu, Sep 07, 2023 at 12:40:45PM +0800, Zhiguo Jiang wrote:
> Fix bool to int of the get_swappiness() return value type in
> lruvec_is_sizable().
>
> The get_swappiness() return value type is int, but the
> get_swappiness() return value type is bool in lruvec_is_sizable().
> So there is a possibility of value overflow.
Have you looked at how the C spec defines int->bool conversion?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-07 4:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 4:40 [PATCH] mm: vmscan: fix get_swappiness() return value type Zhiguo Jiang
2023-09-07 4:50 ` Matthew Wilcox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox