mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 08:35:22 +00:00
virsh: use correct sizeof when allocating cpumap
Found by coverity:
Error: SIZEOF_MISMATCH (CWE-569):
libvirt-0.10.2/tools/virsh-domain.c:4754: suspicious_sizeof: Passing
argument "8UL /* sizeof (cpumap) */" to function
"_vshCalloc(vshControl *, size_t, size_t, char const *, int)" and
then casting the return value to "unsigned char *" is suspicious.
Error: SIZEOF_MISMATCH (CWE-569):
libvirt-0.10.2/tools/virsh-domain.c:4942: suspicious_sizeof: Passing
argument "8UL /* sizeof (cpumap) */" to function
"_vshCalloc(vshControl *, size_t, size_t, char const *, int)" and
then casting the return value to "unsigned char *" is suspicious.
(cherry picked from commit dc04b2a737
)
This commit is contained in:
parent
e4e5a4d349
commit
a565e20b08
@ -4739,7 +4739,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
/* Pin mode: pinning specified vcpu to specified physical cpus*/
|
||||
|
||||
cpumap = vshCalloc(ctl, cpumaplen, sizeof(cpumap));
|
||||
cpumap = vshCalloc(ctl, cpumaplen, sizeof(*cpumap));
|
||||
/* Parse cpulist */
|
||||
cur = cpulist;
|
||||
if (*cur == 0) {
|
||||
@ -4927,7 +4927,7 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
/* Pin mode: pinning emulator threads to specified physical cpus*/
|
||||
|
||||
cpumap = vshCalloc(ctl, cpumaplen, sizeof(cpumap));
|
||||
cpumap = vshCalloc(ctl, cpumaplen, sizeof(*cpumap));
|
||||
/* Parse cpulist */
|
||||
cur = cpulist;
|
||||
if (*cur == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user