mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xenoprof: avoid division by 0
Signed-off-by: Tim Deegan <tim@xen.org> Acked-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
63a47721ad
commit
085f1f2d3a
1 file changed
+7
-4
@@ -193,6 +193,13 @@ static int alloc_xenoprof_struct(
|
||||
unsigned max_max_samples;
|
||||
int i;
|
||||
|
||||
nvcpu = 0;
|
||||
for_each_vcpu ( d, v )
|
||||
nvcpu++;
|
||||
|
||||
if ( !nvcpu )
|
||||
return -EINVAL;
|
||||
|
||||
d->xenoprof = xzalloc(struct xenoprof);
|
||||
if ( d->xenoprof == NULL )
|
||||
{
|
||||
@@ -209,10 +216,6 @@ static int alloc_xenoprof_struct(
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
nvcpu = 0;
|
||||
for_each_vcpu ( d, v )
|
||||
nvcpu++;
|
||||
|
||||
bufsize = sizeof(struct xenoprof_buf);
|
||||
i = sizeof(struct event_log);
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
||||