diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-05-10 11:13:42 -0400 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2011-05-10 11:13:43 -0400 |
commit | 3d8dcb3c76bb2930798f61675c33cce8945ab988 (patch) | |
tree | e66a26e9214bb4d9dc4d57bad238706b05662e1b /arch | |
parent | 83ace2701b81be549cca7af33c5b0499cb2602d6 (diff) |
[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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/s390/oprofile/hwsampler.c | 14 | ||||
-rw-r--r-- | arch/s390/oprofile/hwsampler.h | 4 | ||||
-rw-r--r-- | arch/s390/oprofile/init.c | 8 |
3 files changed, 8 insertions, 18 deletions
diff --git a/arch/s390/oprofile/hwsampler.c b/arch/s390/oprofile/hwsampler.c index 4952872d6f0a..33cbd373cce4 100644 --- a/arch/s390/oprofile/hwsampler.c +++ b/arch/s390/oprofile/hwsampler.c | |||
@@ -1021,20 +1021,14 @@ deallocate_exit: | |||
1021 | return rc; | 1021 | return rc; |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | long hwsampler_query_min_interval(void) | 1024 | unsigned long hwsampler_query_min_interval(void) |
1025 | { | 1025 | { |
1026 | if (min_sampler_rate) | 1026 | return min_sampler_rate; |
1027 | return min_sampler_rate; | ||
1028 | else | ||
1029 | return -EINVAL; | ||
1030 | } | 1027 | } |
1031 | 1028 | ||
1032 | long hwsampler_query_max_interval(void) | 1029 | unsigned long hwsampler_query_max_interval(void) |
1033 | { | 1030 | { |
1034 | if (max_sampler_rate) | 1031 | return max_sampler_rate; |
1035 | return max_sampler_rate; | ||
1036 | else | ||
1037 | return -EINVAL; | ||
1038 | } | 1032 | } |
1039 | 1033 | ||
1040 | unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu) | 1034 | unsigned long hwsampler_get_sample_overflow_count(unsigned int cpu) |
diff --git a/arch/s390/oprofile/hwsampler.h b/arch/s390/oprofile/hwsampler.h index 8c72b59316b5..1912f3bb190c 100644 --- a/arch/s390/oprofile/hwsampler.h +++ b/arch/s390/oprofile/hwsampler.h | |||
@@ -102,8 +102,8 @@ int hwsampler_setup(void); | |||
102 | int hwsampler_shutdown(void); | 102 | int hwsampler_shutdown(void); |
103 | int hwsampler_allocate(unsigned long sdbt, unsigned long sdb); | 103 | int hwsampler_allocate(unsigned long sdbt, unsigned long sdb); |
104 | int hwsampler_deallocate(void); | 104 | int hwsampler_deallocate(void); |
105 | long hwsampler_query_min_interval(void); | 105 | unsigned long hwsampler_query_min_interval(void); |
106 | long hwsampler_query_max_interval(void); | 106 | unsigned long hwsampler_query_max_interval(void); |
107 | int hwsampler_start_all(unsigned long interval); | 107 | int hwsampler_start_all(unsigned long interval); |
108 | int hwsampler_stop_all(void); | 108 | int hwsampler_stop_all(void); |
109 | int hwsampler_deactivate(unsigned int cpu); | 109 | int hwsampler_deactivate(unsigned int cpu); |
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c index c63d7e58352b..5995e9bc72d9 100644 --- a/arch/s390/oprofile/init.c +++ b/arch/s390/oprofile/init.c | |||
@@ -145,15 +145,11 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops) | |||
145 | * create hwsampler files only if hwsampler_setup() succeeds. | 145 | * create hwsampler files only if hwsampler_setup() succeeds. |
146 | */ | 146 | */ |
147 | oprofile_min_interval = hwsampler_query_min_interval(); | 147 | oprofile_min_interval = hwsampler_query_min_interval(); |
148 | if (oprofile_min_interval < 0) { | 148 | if (oprofile_min_interval == 0) |
149 | oprofile_min_interval = 0; | ||
150 | return -ENODEV; | 149 | return -ENODEV; |
151 | } | ||
152 | oprofile_max_interval = hwsampler_query_max_interval(); | 150 | oprofile_max_interval = hwsampler_query_max_interval(); |
153 | if (oprofile_max_interval < 0) { | 151 | if (oprofile_max_interval == 0) |
154 | oprofile_max_interval = 0; | ||
155 | return -ENODEV; | 152 | return -ENODEV; |
156 | } | ||
157 | 153 | ||
158 | if (oprofile_timer_init(ops)) | 154 | if (oprofile_timer_init(ops)) |
159 | return -ENODEV; | 155 | return -ENODEV; |