Skip to contentSkip to conversation

Fix variable "error" missing initialization

PATCH In review Shawn Chang 2 participants 2 messages Apr 29, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Fix variable "error" missing initialization

From: Shawn C <[email protected]>

---
 mm/mlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mlock.c +1 -1
index c7f6785..660e5c5 100644
@@ -557,7 +557,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
 {
 	unsigned long nstart, end, tmp;
 	struct vm_area_struct * vma, * prev;
-	int error;
+	int error = 0;
 
 	VM_BUG_ON(start & ~PAGE_MASK);
 	VM_BUG_ON(len != PAGE_ALIGN(len));
Signature · 7 lines
1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 23 lines · Shawn Chang

From: Shawn C <[email protected]>

---
 mm/mlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mlock.c +1 -1
index c7f6785..660e5c5 100644
@@ -557,7 +557,7 @@ static int do_mlock(unsigned long start, size_t len, int on)
 {
 	unsigned long nstart, end, tmp;
 	struct vm_area_struct * vma, * prev;
-	int error;
+	int error = 0;
 
 	VM_BUG_ON(start & ~PAGE_MASK);
 	VM_BUG_ON(len != PAGE_ALIGN(len));
Signature · 1 line
1.9.1

This change does not make sense.

The very first read of error is after it gets set.

I see you sent another patch which credited grsecurity. In their patchset it makes sense - do_mlock is modified in a way which can interrupt the loop upcoming loop before it gets the chance to set error.

Signature · 7 lines
Mateusz Guzik

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>