VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Chen Jun <chenjun102@huawei.com> 2021-09-24 15:44:06 -0700 committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-09-24 16:13:35 -0700 commit: bcbda81020c3ee77e2c098cadf3e84f99ca3de17 parent: 5c91c0e77b8f2681e2b269c8abb4c5acef434d5b
Commit Summary:
mm: fix uninitialized use in overcommit_policy_handler
Diffstat:
1 file changed, 2 insertions, 2 deletions
diff --git a/mm/util.c b/mm/util.c
index 499b6b5767ed..bacabe446906 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -787,7 +787,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer,
 		size_t *lenp, loff_t *ppos)
 {
 	struct ctl_table t;
-	int new_policy;
+	int new_policy = -1;
 	int ret;
 
 	/*
@@ -805,7 +805,7 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer,
 		t = *table;
 		t.data = &new_policy;
 		ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
-		if (ret)
+		if (ret || new_policy == -1)
 			return ret;
 
 		mm_compute_batch(new_policy);