* [KJ] [PATCH][RESUBMIT][1/21] arch/i386/math-emu/* - compile warning
@ 2005-02-14 22:02 Stephen Biggs
0 siblings, 0 replies; only message in thread
From: Stephen Biggs @ 2005-02-14 22:02 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 4601 bytes --]
Description: compile warning cleanup - handle copy_to/from_user error
returns
Signed-off-by: Stephen Biggs <yrgrknmxpzlk@gawab.com>
diff -Nurdp -X dontdiff-osdl linux-2.6.11-rc3-mm2-original/arch/i386/math-emu/fpu_entry.c linux-2.6.11-rc3-mm2/arch/i386/math-emu/fpu_entry.c
--- linux-2.6.11-rc3-mm2-original/arch/i386/math-emu/fpu_entry.c 2005-02-12 12:06:23.000000000 +0200
+++ linux-2.6.11-rc3-mm2/arch/i386/math-emu/fpu_entry.c 2005-02-12 19:17:48.000000000 +0200
@@ -742,7 +742,8 @@ int save_i387_soft(void *s387, struct _f
S387->fcs &= ~0xf8000000;
S387->fos |= 0xffff0000;
#endif /* PECULIAR_486 */
- __copy_to_user(d, &S387->cwd, 7*4);
+ if (__copy_to_user(d, &S387->cwd, 7*4))
+ return -1;
RE_ENTRANT_CHECK_ON;
d += 7*4;
diff -Nurdp -X dontdiff-osdl linux-2.6.11-rc3-mm2-original/arch/i386/math-emu/reg_ld_str.c linux-2.6.11-rc3-mm2/arch/i386/math-emu/reg_ld_str.c
--- linux-2.6.11-rc3-mm2-original/arch/i386/math-emu/reg_ld_str.c 2004-12-24 23:35:01.000000000 +0200
+++ linux-2.6.11-rc3-mm2/arch/i386/math-emu/reg_ld_str.c 2005-02-12 19:17:48.000000000 +0200
@@ -89,12 +89,17 @@ int FPU_tagof(FPU_REG *ptr)
int FPU_load_extended(long double __user *s, int stnr)
{
FPU_REG *sti_ptr = &st(stnr);
+ int user_copy_err;
RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_READ, s, 10);
- __copy_from_user(sti_ptr, s, 10);
+ user_copy_err = __copy_from_user(sti_ptr, s, 10);
RE_ENTRANT_CHECK_ON;
+ if (user_copy_err) {
+ EXCEPTION(EX_INTERNAL);
+ return TAG_Special;
+ }
return FPU_tagof(sti_ptr);
}
@@ -240,13 +245,19 @@ int FPU_load_int64(long long __user *_s)
{
long long s;
int sign;
+ int user_copy_err;
FPU_REG *st0_ptr = &st(0);
RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_READ, _s, 8);
- copy_from_user(&s,_s,8);
+ user_copy_err = copy_from_user(&s,_s,8);
RE_ENTRANT_CHECK_ON;
+ if (user_copy_err) {
+ EXCEPTION(EX_INTERNAL);
+ return TAG_Special;
+ }
+
if (s == 0)
{
reg_copy(&CONST_Z, st0_ptr);
@@ -859,6 +870,7 @@ int FPU_store_int64(FPU_REG *st0_ptr, u_
FPU_REG t;
long long tll;
int precision_loss;
+ int user_copy_err;
if ( st0_tag == TAG_Empty )
{
@@ -907,9 +919,14 @@ int FPU_store_int64(FPU_REG *st0_ptr, u_
RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_WRITE,d,8);
- copy_to_user(d, &tll, 8);
+ user_copy_err = copy_to_user(d, &tll, 8);
RE_ENTRANT_CHECK_ON;
+ if (user_copy_err) {
+ EXCEPTION(EX_INTERNAL);
+ return 0;
+ }
+
return 1;
}
@@ -1271,15 +1288,21 @@ void frstor(fpu_addr_modes addr_modes, u
int i, regnr;
u_char __user *s = fldenv(addr_modes, data_address);
int offset = (top & 7) * 10, other = 80 - offset;
+ int user_copy_err;
/* Copy all registers in stack order. */
RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_READ,s,80);
- __copy_from_user(register_base+offset, s, other);
- if ( offset )
- __copy_from_user(register_base, s+other, offset);
+ user_copy_err = __copy_from_user(register_base+offset, s, other);
+ if (!user_copy_err && offset)
+ user_copy_err = __copy_from_user(register_base, s+other, offset);
RE_ENTRANT_CHECK_ON;
+ if (user_copy_err) {
+ EXCEPTION(EX_INTERNAL);
+ return;
+ }
+
for ( i = 0; i < 8; i++ )
{
regnr = (i+top) & 7;
@@ -1325,6 +1348,7 @@ u_char __user *fstenv(fpu_addr_modes add
}
else
{
+ int user_copy_err;
RE_ENTRANT_CHECK_OFF;
FPU_verify_area(VERIFY_WRITE, d, 7*4);
#ifdef PECULIAR_486
@@ -1336,8 +1360,12 @@ u_char __user *fstenv(fpu_addr_modes add
I387.soft.fcs &= ~0xf8000000;
I387.soft.fos |= 0xffff0000;
#endif /* PECULIAR_486 */
- __copy_to_user(d, &control_word, 7*4);
+ user_copy_err = __copy_to_user(d, &control_word, 7*4);
RE_ENTRANT_CHECK_ON;
+
+ if (user_copy_err)
+ EXCEPTION(EX_INTERNAL);
+
d += 0x1c;
}
@@ -1352,6 +1380,7 @@ void fsave(fpu_addr_modes addr_modes, u_
{
u_char __user *d;
int offset = (top & 7) * 10, other = 80 - offset;
+ int user_copy_err;
d = fstenv(addr_modes, data_address);
@@ -1359,11 +1388,14 @@ void fsave(fpu_addr_modes addr_modes, u_
FPU_verify_area(VERIFY_WRITE,d,80);
/* Copy all registers in stack order. */
- __copy_to_user(d, register_base+offset, other);
- if ( offset )
- __copy_to_user(d+other, register_base, offset);
+ user_copy_err = __copy_to_user(d, register_base+offset, other);
+ if (!user_copy_err && offset)
+ user_copy_err = __copy_to_user(d+other, register_base, offset);
RE_ENTRANT_CHECK_ON;
+ if (user_copy_err)
+ EXCEPTION(EX_INTERNAL);
+
finit();
}
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-02-14 22:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-14 22:02 [KJ] [PATCH][RESUBMIT][1/21] arch/i386/math-emu/* - compile warning Stephen Biggs
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.