Skip to contentSkip to conversation

Staging: dream, fix buf overflow

PATCH In review Jiri Slaby 2 participants 2 messages Aug 8, 2009 Staging

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 Staging: dream, fix buf overflow

Not even compile-tested. I don't have an arm toolchain. --

In vfe_send_msg_no_payload there is a wrong struct vfe_message allocation. It allocates only sizeof(pointer to vfe_message) for a whole structure. Add a dereference to the sizeof to allocate sizeof(vfe_message).

---
 drivers/staging/dream/camera/msm_vfe8x_proc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/dream/camera/msm_vfe8x_proc.c +1 -1
index bb65013..5436f71 100644
@@ -818,7 +818,7 @@ static void vfe_send_msg_no_payload(enum VFE_MESSAGE_ID id)
 {
 	struct vfe_message *msg;
 
-	msg = kzalloc(sizeof(msg), GFP_ATOMIC);
+	msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
 	if (!msg)
 		return;
 
Signature · 1 line
1.6.3.3
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jiri Slaby

Not even compile-tested. I don't have an arm toolchain. --

In vfe_send_msg_no_payload there is a wrong struct vfe_message allocation. It allocates only sizeof(pointer to vfe_message) for a whole structure. Add a dereference to the sizeof to allocate sizeof(vfe_message).

(Google, you may want to fix this in your code, too.)

Quoted 17 lines
---
 drivers/staging/dream/camera/msm_vfe8x_proc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/dream/camera/msm_vfe8x_proc.c +1 -1
index bb65013..5436f71 100644
@@ -818,7 +818,7 @@ static void vfe_send_msg_no_payload(enum VFE_MESSAGE_ID id)
 {
 	struct vfe_message *msg;
 
-	msg = kzalloc(sizeof(msg), GFP_ATOMIC);
+	msg = kzalloc(sizeof(*msg), GFP_ATOMIC);
 	if (!msg)
 		return;
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html