aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/paride/pg.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2011-11-16 03:21:50 -0500
committerJens Axboe <axboe@kernel.dk>2011-11-16 03:21:50 -0500
commita2c2a0e668e26e020731ce2a40e6474d1d37210a (patch)
tree81f0f6aabffb97fe6c0ec06fd7042c5147cceb9c /drivers/block/paride/pg.c
parent121f099412bd6576dfb3d94222e89d9341362177 (diff)
paride: fix potential information leak in pg_read()
Smatch has a new check for Rosenberg type information leaks where structs are copied to the user with uninitialized stack data in them. i In this case, the pg_write_hdr struct has a hole in it. struct pg_write_hdr { char magic; /* 0 1 */ char func; /* 1 1 */ /* XXX 2 bytes hole, try to pack */ int dlen; /* 4 4 */ Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: Tim Waugh <tim@cyberelk.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/paride/pg.c')
-rw-r--r--drivers/block/paride/pg.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 6b9a2000d56a..a79fb4f7ff62 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -630,6 +630,7 @@ static ssize_t pg_read(struct file *filp, char __user *buf, size_t count, loff_t
630 if (dev->status & 0x10) 630 if (dev->status & 0x10)
631 return -ETIME; 631 return -ETIME;
632 632
633 memset(&hdr, 0, sizeof(hdr));
633 hdr.magic = PG_MAGIC; 634 hdr.magic = PG_MAGIC;
634 hdr.dlen = dev->dlen; 635 hdr.dlen = dev->dlen;
635 copy = 0; 636 copy = 0;