On 02/03/20 02:58, Julio Faracco wrote:
> Sorry my ignorance, Paolo.
> But why should I remove MAX_{VM,VCPU}_ID?
>
> Did you mean that check?
> if (vm_id > MAX_VM_ID || vcpu_id > MAX_VCPU_ID) {
> fprintf(stderr, "Too big vm id %x or vcpu id %x\n", vm_id, vcpu_id);
> return NULL
Sorry my ignorance, Paolo.
But why should I remove MAX_{VM,VCPU}_ID?
Did you mean that check?
if (vm_id > MAX_VM_ID || vcpu_id > MAX_VCPU_ID) {
fprintf(stderr, "Too big vm id %x or vcpu id %x\n", vm_id, vcpu_id);
return NULL;
}
Wouldn't it be dangerous?
--
Julio Cesar Far
On 01/03/20 20:21, Julio Faracco wrote:
> +assert(vm_id < 0);
> +
> +if (snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d",
> + vm_id) < 0)
> +return NULL;
> +
> return name;
> }
>
> @@ -140,8 +145,12 @@ static char *hax_vcpu_devfs_string(int vm_id, in
When HAX is enabled (--enable-hax), GCC 9.2.1 reports issues with
snprintf(). This commit is checking if snprintf returns an error. This
is a simple way to avoid this warnings. An `assert()` boundary checks
were added before snprintf too.
For more details, one example of warning:
CC i386-so