Re: [PATCH v2] i386: Fix GCC warning with snprintf when HAX is enabled

2020-03-01 Thread Richard Henderson
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

Re: [PATCH v2] i386: Fix GCC warning with snprintf when HAX is enabled

2020-03-01 Thread Richard Henderson
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

[PATCH v2] i386: Fix GCC warning with snprintf when HAX is enabled

2020-03-01 Thread Julio Faracco
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