Skip to contentSkip to conversation

ipc: fix local variable initialization in compat_do_msg_fill()

PATCH In review Konstantin Khlebnikov 1 participant 2 messages Apr 19, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipc: fix local variable initialization in compat_do_msg_fill()

The "msgp" must points to the userspace buffer.

fix for linux-next commit 774d0252d303969a7281eefd6eaccde50bb6eb6e ("c/r: ipc: message queue receive cleanup")

Cc Stanislav Kinsbursky <[email protected]>
Cc Lucas De Marchi <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Cyrill Gorcunov <[email protected]>
Cc Pavel Emelyanov <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andrew Morton <[email protected]>
---
 ipc/compat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/compat.c +1 -1
index 6da376b..0c2ebd0 100644
@@ -363,7 +363,7 @@ static long compat_do_msg_steal(void __user *dest, struct msg_msg *msg, size_t b
 
 long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
 {
-	struct compat_msgbuf __user *msgp;
+	struct compat_msgbuf __user *msgp = dest;
 	size_t msgsz;
 
 	if (put_user(msg->m_type, &msgp->mtype))
#1 lore raw
Quoted 4 lines · Konstantin Khlebnikov

The "msgp" must points to the userspace buffer.

fix for linux-next commit 774d0252d303969a7281eefd6eaccde50bb6eb6e ("c/r: ipc: message queue receive cleanup")

Oops, Dan Carpenter had caught this several days before me:
[patch] c/r: ipc: uninitialized variable in compat_do_msg_fill()

Quoted 27 lines
Cc Stanislav Kinsbursky<[email protected]>
Cc Lucas De Marchi<[email protected]>
Cc Chris Metcalf<[email protected]>
Cc Cyrill Gorcunov<[email protected]>
Cc Pavel Emelyanov<[email protected]>
Cc Arnd Bergmann<[email protected]>
Cc Andrew Morton<[email protected]>
---
  ipc/compat.c |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
ipc/compat.c +1 -1
index 6da376b..0c2ebd0 100644
@@ -363,7 +363,7 @@ static long compat_do_msg_steal(void __user *dest, struct msg_msg *msg, size_t b
 
  long compat_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
  {
-	struct compat_msgbuf __user *msgp;
+	struct compat_msgbuf __user *msgp = dest;
  	size_t msgsz;
 
  	if (put_user(msg->m_type,&msgp->mtype))