@@ -2634,6 +2634,7 @@ struct compat_sysinfo {
2634
2634
COMPAT_SYSCALL_DEFINE1 (sysinfo , struct compat_sysinfo __user * , info )
2635
2635
{
2636
2636
struct sysinfo s ;
2637
+ struct compat_sysinfo s_32 ;
2637
2638
2638
2639
do_sysinfo (& s );
2639
2640
@@ -2658,23 +2659,23 @@ COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
2658
2659
s .freehigh >>= bitcount ;
2659
2660
}
2660
2661
2661
- if (!access_ok (info , sizeof (struct compat_sysinfo )) ||
2662
- __put_user (s .uptime , & info -> uptime ) ||
2663
- __put_user (s .loads [0 ], & info -> loads [0 ]) ||
2664
- __put_user (s .loads [1 ], & info -> loads [1 ]) ||
2665
- __put_user (s .loads [2 ], & info -> loads [2 ]) ||
2666
- __put_user (s .totalram , & info -> totalram ) ||
2667
- __put_user (s .freeram , & info -> freeram ) ||
2668
- __put_user (s .sharedram , & info -> sharedram ) ||
2669
- __put_user (s .bufferram , & info -> bufferram ) ||
2670
- __put_user (s .totalswap , & info -> totalswap ) ||
2671
- __put_user (s .freeswap , & info -> freeswap ) ||
2672
- __put_user (s .procs , & info -> procs ) ||
2673
- __put_user (s .totalhigh , & info -> totalhigh ) ||
2674
- __put_user (s .freehigh , & info -> freehigh ) ||
2675
- __put_user (s .mem_unit , & info -> mem_unit ))
2662
+ memset (& s_32 , 0 , sizeof (s_32 ));
2663
+ s_32 .uptime = s .uptime ;
2664
+ s_32 .loads [0 ] = s .loads [0 ];
2665
+ s_32 .loads [1 ] = s .loads [1 ];
2666
+ s_32 .loads [2 ] = s .loads [2 ];
2667
+ s_32 .totalram = s .totalram ;
2668
+ s_32 .freeram = s .freeram ;
2669
+ s_32 .sharedram = s .sharedram ;
2670
+ s_32 .bufferram = s .bufferram ;
2671
+ s_32 .totalswap = s .totalswap ;
2672
+ s_32 .freeswap = s .freeswap ;
2673
+ s_32 .procs = s .procs ;
2674
+ s_32 .totalhigh = s .totalhigh ;
2675
+ s_32 .freehigh = s .freehigh ;
2676
+ s_32 .mem_unit = s .mem_unit ;
2677
+ if (copy_to_user (info , & s_32 , sizeof (s_32 )))
2676
2678
return - EFAULT ;
2677
-
2678
2679
return 0 ;
2679
2680
}
2680
2681
#endif /* CONFIG_COMPAT */
0 commit comments