diff options
Diffstat (limited to 'drivers/message')
-rw-r--r-- | drivers/message/i2o/i2o_config.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c index 4dd39a03082..068ba0785bb 100644 --- a/drivers/message/i2o/i2o_config.c +++ b/drivers/message/i2o/i2o_config.c | |||
@@ -111,9 +111,9 @@ static int i2o_cfg_gethrt(unsigned long arg) | |||
111 | 111 | ||
112 | len = 8 + ((hrt->entry_len * hrt->num_entries) << 2); | 112 | len = 8 + ((hrt->entry_len * hrt->num_entries) << 2); |
113 | 113 | ||
114 | /* We did a get user...so assuming mem is ok...is this bad? */ | 114 | if (put_user(len, kcmd.reslen)) |
115 | put_user(len, kcmd.reslen); | 115 | ret = -EFAULT; |
116 | if (len > reslen) | 116 | else if (len > reslen) |
117 | ret = -ENOBUFS; | 117 | ret = -ENOBUFS; |
118 | else if (copy_to_user(kcmd.resbuf, (void *)hrt, len)) | 118 | else if (copy_to_user(kcmd.resbuf, (void *)hrt, len)) |
119 | ret = -EFAULT; | 119 | ret = -EFAULT; |
@@ -147,8 +147,9 @@ static int i2o_cfg_getlct(unsigned long arg) | |||
147 | lct = (i2o_lct *) c->lct; | 147 | lct = (i2o_lct *) c->lct; |
148 | 148 | ||
149 | len = (unsigned int)lct->table_size << 2; | 149 | len = (unsigned int)lct->table_size << 2; |
150 | put_user(len, kcmd.reslen); | 150 | if (put_user(len, kcmd.reslen)) |
151 | if (len > reslen) | 151 | ret = -EFAULT; |
152 | else if (len > reslen) | ||
152 | ret = -ENOBUFS; | 153 | ret = -ENOBUFS; |
153 | else if (copy_to_user(kcmd.resbuf, lct, len)) | 154 | else if (copy_to_user(kcmd.resbuf, lct, len)) |
154 | ret = -EFAULT; | 155 | ret = -EFAULT; |
@@ -208,8 +209,9 @@ static int i2o_cfg_parms(unsigned long arg, unsigned int type) | |||
208 | return -EAGAIN; | 209 | return -EAGAIN; |
209 | } | 210 | } |
210 | 211 | ||
211 | put_user(len, kcmd.reslen); | 212 | if (put_user(len, kcmd.reslen)) |
212 | if (len > reslen) | 213 | ret = -EFAULT; |
214 | else if (len > reslen) | ||
213 | ret = -ENOBUFS; | 215 | ret = -ENOBUFS; |
214 | else if (copy_to_user(kcmd.resbuf, res, len)) | 216 | else if (copy_to_user(kcmd.resbuf, res, len)) |
215 | ret = -EFAULT; | 217 | ret = -EFAULT; |