@@ -4073,7 +4073,7 @@ int f_sys_getrlimit_setrlimit_e(struct event_filler_arguments *args)
40734073 */
40744074 syscall_get_arguments_deprecated (args , 0 , 1 , & val );
40754075
4076- ppm_resource = rlimit_resource_to_scap (val );
4076+ ppm_resource = rlimit_resource_to_scap (( uint32_t ) val );
40774077
40784078 res = val_to_ring (args , (uint64_t )ppm_resource , 0 , false, 0 );
40794079 CHECK_RES (res );
@@ -4100,16 +4100,16 @@ int f_sys_getrlimit_x(struct event_filler_arguments *args) {
41004100 /*
41014101 * Copy the user structure and extract cur and max
41024102 */
4103- if (retval >= 0 || args -> event_type == PPME_SYSCALL_SETRLIMIT_X )
4104- {
4103+ if (retval >= 0 ) {
4104+
41054105 syscall_get_arguments_deprecated (args , 1 , 1 , & val );
41064106
41074107#ifdef CONFIG_COMPAT
41084108 if (!args -> compat )
41094109 {
41104110#endif
41114111 if (unlikely (ppm_copy_from_user (& rl , (const void __user * )val , sizeof (struct rlimit ))))
4112- return PPM_FAILURE_INVALID_USER_MEMORY ;
4112+ return PPM_FAILURE_INVALID_USER_MEMORY ;
41134113 cur = rl .rlim_cur ;
41144114 max = rl .rlim_max ;
41154115#ifdef CONFIG_COMPAT
@@ -4143,17 +4143,17 @@ int f_sys_getrlimit_x(struct event_filler_arguments *args) {
41434143
41444144
41454145
4146- int f_sys_setrlrimit_x (struct event_filler_arguments * args )
4146+ int f_sys_setrlimit_x (struct event_filler_arguments * args )
41474147{
41484148 unsigned long val ;
41494149 int res ;
41504150 int64_t retval ;
4151- struct rlimit rl ;
41524151#ifdef CONFIG_COMPAT
41534152 struct compat_rlimit compat_rl ;
41544153#endif
41554154 int64_t cur ;
41564155 int64_t max ;
4156+ struct rlimit rl = {0 };
41574157
41584158 /* Parameter 1: res (type: PT_ERRNO) */
41594159 retval = (int64_t )(long )syscall_get_return_value (current , args -> regs );
@@ -4163,14 +4163,12 @@ int f_sys_setrlrimit_x(struct event_filler_arguments *args)
41634163 /*
41644164 * Copy the user structure and extract cur and max
41654165 */
4166- if (retval >= 0 || args -> event_type == PPME_SYSCALL_SETRLIMIT_X ) {
41674166 syscall_get_arguments_deprecated (args , 1 , 1 , & val );
41684167
41694168#ifdef CONFIG_COMPAT
41704169 if (!args -> compat ) {
41714170#endif
4172- if (unlikely (ppm_copy_from_user (& rl , (const void __user * )val , sizeof (struct rlimit ))))
4173- return PPM_FAILURE_INVALID_USER_MEMORY ;
4171+ ppm_copy_from_user (& rl , (const void __user * )val , sizeof (struct rlimit ));
41744172 cur = rl .rlim_cur ;
41754173 max = rl .rlim_max ;
41764174#ifdef CONFIG_COMPAT
@@ -4181,12 +4179,8 @@ int f_sys_setrlrimit_x(struct event_filler_arguments *args)
41814179 max = compat_rl .rlim_max ;
41824180 }
41834181#endif
4184- } else {
4185- cur = -1 ;
4186- max = -1 ;
4187- }
41884182
4189- /* Parameter 2: (type: PT_INT64) */
4183+ /* Parameter 2: curr (type: PT_INT64) */
41904184 res = val_to_ring (args , cur , 0 , false, 0 );
41914185 CHECK_RES (res );
41924186
@@ -4196,7 +4190,7 @@ int f_sys_setrlrimit_x(struct event_filler_arguments *args)
41964190
41974191 /* Parameter 4: resource (type: PT_ENUMFLAGS8) */
41984192 syscall_get_arguments_deprecated (args , 0 , 1 , & val );
4199- res = val_to_ring (args , rlimit_resource_to_scap (val ), 0 , false, 0 );
4193+ res = val_to_ring (args , rlimit_resource_to_scap (( uint32_t ) val ), 0 , false, 0 );
42004194 CHECK_RES (res );
42014195
42024196 return add_sentinel (args );
@@ -4216,7 +4210,7 @@ int f_sys_prlimit_e(struct event_filler_arguments *args)
42164210
42174211 /* Parameter 2: resource (type: PT_ENUMFLAGS8) */
42184212 syscall_get_arguments_deprecated (args , 1 , 1 , & val );
4219- res = val_to_ring (args , rlimit_resource_to_scap (val ), 0 , false, 0 );
4213+ res = val_to_ring (args , rlimit_resource_to_scap (( uint32_t ) val ), 0 , false, 0 );
42204214 CHECK_RES (res );
42214215
42224216 return add_sentinel (args );
@@ -4321,7 +4315,7 @@ int f_sys_prlimit_x(struct event_filler_arguments *args)
43214315
43224316 /* Parameter 7: resource (type: PT_ENUMFLAGS8) */
43234317 syscall_get_arguments_deprecated (args , 1 , 1 , & val );
4324- res = val_to_ring (args , rlimit_resource_to_scap (val ), 0 , false, 0 );
4318+ res = val_to_ring (args , rlimit_resource_to_scap (( uint32_t ) val ), 0 , false, 0 );
43254319 CHECK_RES (res );
43264320
43274321 return add_sentinel (args );
0 commit comments