[S390] oprofile: fix min/max interval query checks
oprofile_min_interval and oprofile_max_interval are unsigned, checking for negative values doesn't work. Change hwsampler_query_min_interval and hwsampler_query_max_interval to return an unsigned long and check for a zero value instead. Reported-by: Nicolas Kaiser <nikai@nikai.net> Acked-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
83ace2701b
commit
3d8dcb3c76
|
@ -1021,20 +1021,14 @@ deallocate_exit:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
long hwsampler_query_min_interval(void)
|
unsigned long hwsampler_query_min_interval(void)
|
||||||
{
|
{
|
||||||
if (min_sampler_rate)
|
return min_sampler_rate;
|
||||||
return min_sampler_rate;
|
|
||||||
else
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long hwsampler_query_max_interval(void)
|
unsigned long hwsampler_query_max_interval(void)
|
||||||
{
|
{
|
||||||
if (max_sampler_rate)
|
return max_sampler_rate;
|
||||||
return max_sampler_rate;
|
|
||||||
else
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu)
|
unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu)
|
||||||
|
|
|
@ -102,8 +102,8 @@ int hwsampler_setup(void);
|
||||||
int hwsampler_shutdown(void);
|
int hwsampler_shutdown(void);
|
||||||
int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
|
int hwsampler_allocate(unsigned long sdbt, unsigned long sdb);
|
||||||
int hwsampler_deallocate(void);
|
int hwsampler_deallocate(void);
|
||||||
long hwsampler_query_min_interval(void);
|
unsigned long hwsampler_query_min_interval(void);
|
||||||
long hwsampler_query_max_interval(void);
|
unsigned long hwsampler_query_max_interval(void);
|
||||||
int hwsampler_start_all(unsigned long interval);
|
int hwsampler_start_all(unsigned long interval);
|
||||||
int hwsampler_stop_all(void);
|
int hwsampler_stop_all(void);
|
||||||
int hwsampler_deactivate(unsigned int cpu);
|
int hwsampler_deactivate(unsigned int cpu);
|
||||||
|
|
|
@ -145,15 +145,11 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
|
||||||
* create hwsampler files only if hwsampler_setup() succeeds.
|
* create hwsampler files only if hwsampler_setup() succeeds.
|
||||||
*/
|
*/
|
||||||
oprofile_min_interval = hwsampler_query_min_interval();
|
oprofile_min_interval = hwsampler_query_min_interval();
|
||||||
if (oprofile_min_interval < 0) {
|
if (oprofile_min_interval == 0)
|
||||||
oprofile_min_interval = 0;
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
oprofile_max_interval = hwsampler_query_max_interval();
|
oprofile_max_interval = hwsampler_query_max_interval();
|
||||||
if (oprofile_max_interval < 0) {
|
if (oprofile_max_interval == 0)
|
||||||
oprofile_max_interval = 0;
|
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
|
|
||||||
if (oprofile_timer_init(ops))
|
if (oprofile_timer_init(ops))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
Loading…
Reference in New Issue