Skip to content

Commit 584ff0d

Browse files
zhans00torvalds
authored andcommitted
mm: KSM: fix data type
ksm_stable_node_chains_prune_millisecs is declared as int, but in stable__node_chains_prune_millisecs_store(), it can store values up to UINT_MAX. Change its type to unsigned int. Link: https://lkml.kernel.org/r/20210806111351.GA71845@asus Signed-off-by: Zhansaya Bagdauletkyzy <[email protected]> Cc: Hugh Dickins <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 82e717a commit 584ff0d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mm/ksm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static unsigned long ksm_stable_node_chains;
259259
static unsigned long ksm_stable_node_dups;
260260

261261
/* Delay in pruning stale stable_node_dups in the stable_node_chains */
262-
static int ksm_stable_node_chains_prune_millisecs = 2000;
262+
static unsigned int ksm_stable_node_chains_prune_millisecs = 2000;
263263

264264
/* Maximum number of page slots sharing a stable node */
265265
static int ksm_max_page_sharing = 256;
@@ -3105,11 +3105,11 @@ stable_node_chains_prune_millisecs_store(struct kobject *kobj,
31053105
struct kobj_attribute *attr,
31063106
const char *buf, size_t count)
31073107
{
3108-
unsigned long msecs;
3108+
unsigned int msecs;
31093109
int err;
31103110

3111-
err = kstrtoul(buf, 10, &msecs);
3112-
if (err || msecs > UINT_MAX)
3111+
err = kstrtouint(buf, 10, &msecs);
3112+
if (err)
31133113
return -EINVAL;
31143114

31153115
ksm_stable_node_chains_prune_millisecs = msecs;

0 commit comments

Comments
 (0)