[Cbe-oss-dev] [PATCH] spufs: Don't copy unintialised data during mbox_info reads
Jeremy Kerr
jk at ozlabs.org
Fri Jul 6 15:32:10 EST 2007
For the spufs {m,w,i}box_info files, we only set the data buffer under
certain conditions, but we unconditionally copy it to userspace.
This change always initialises the buffer to 0 before doing the
simple_read_from_buffer().
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
Paul - this is a contender for 2.6.22.
arch/powerpc/platforms/cell/spufs/file.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index c2814ea..0887c82 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -1827,7 +1827,7 @@ static ssize_t __spufs_mbox_info_read(struct spu_context *ctx,
char __user *buf, size_t len, loff_t *pos)
{
u32 mbox_stat;
- u32 data;
+ u32 data = 0;
mbox_stat = ctx->csa.prob.mb_stat_R;
if (mbox_stat & 0x0000ff) {
@@ -1865,7 +1865,7 @@ static ssize_t __spufs_ibox_info_read(struct spu_context *ctx,
char __user *buf, size_t len, loff_t *pos)
{
u32 ibox_stat;
- u32 data;
+ u32 data = 0;
ibox_stat = ctx->csa.prob.mb_stat_R;
if (ibox_stat & 0xff0000) {
@@ -1906,6 +1906,8 @@ static ssize_t __spufs_wbox_info_read(struct spu_context *ctx,
u32 data[4];
u32 wbox_stat;
+ memset(data, 0, sizeof(data));
+
wbox_stat = ctx->csa.prob.mb_stat_R;
cnt = 4 - ((wbox_stat & 0x00ff00) >> 8);
for (i = 0; i < cnt; i++) {
--
1.5.0.rc4.g85b1
More information about the cbe-oss-dev
mailing list