On 3/1/20 11:17 AM, Julio Faracco wrote:
> -snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d", vm_id);
> +assert(vm_id < 0);
> +
> +if (snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d",
> + vm_id) < 0)
> +return NULL;
> +
And the assert is opposit
On 3/1/20 11:17 AM, Julio Faracco wrote:
> -snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d", vm_id);
> +assert(vm_id < 0);
> +
> +if (snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d",
> + vm_id) < 0)
> +return NULL;
> +
No, you don't need the IF
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