Commit 9518f179 authored by Julia Lawall's avatar Julia Lawall Committed by Mauro Carvalho Chehab

V4L/DVB (13685): Correct code taking the size of a pointer

sizeof(print_buf) is just the size of the pointer.  Change it to the size
used in the allocation of print_buf earlier in the same function.

A simplified version of the semantic patch that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
expression f;
type T;
@@

*f(...,(T)x,...)
// </smpl>

Cc: Janne Grunau <j@jannau.net>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b4d887cf
...@@ -145,7 +145,7 @@ static int device_authorization(struct hdpvr_device *dev) ...@@ -145,7 +145,7 @@ static int device_authorization(struct hdpvr_device *dev)
#ifdef HDPVR_DEBUG #ifdef HDPVR_DEBUG
else { else {
hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf, hex_dump_to_buffer(dev->usbc_buf, 46, 16, 1, print_buf,
sizeof(print_buf), 0); 5*buf_size+1, 0);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev,
"Status request returned, len %d: %s\n", "Status request returned, len %d: %s\n",
ret, print_buf); ret, print_buf);
...@@ -168,13 +168,13 @@ static int device_authorization(struct hdpvr_device *dev) ...@@ -168,13 +168,13 @@ static int device_authorization(struct hdpvr_device *dev)
response = dev->usbc_buf+38; response = dev->usbc_buf+38;
#ifdef HDPVR_DEBUG #ifdef HDPVR_DEBUG
hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n", v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, "challenge: %s\n",
print_buf); print_buf);
#endif #endif
challenge(response); challenge(response);
#ifdef HDPVR_DEBUG #ifdef HDPVR_DEBUG
hex_dump_to_buffer(response, 8, 16, 1, print_buf, sizeof(print_buf), 0); hex_dump_to_buffer(response, 8, 16, 1, print_buf, 5*buf_size+1, 0);
v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n", v4l2_dbg(MSG_INFO, hdpvr_debug, &dev->v4l2_dev, " response: %s\n",
print_buf); print_buf);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment