
On 5/22/24 12:22, Daniel P. Berrangé wrote:
On Wed, May 22, 2024 at 12:08:15PM +0200, Michal Privoznik wrote:
The virStateDriver struct has .stateInitialize callback which is declared to return virDrvStateInitResult enum. But some drivers return a plain int in their implementation which is UB.
Any idea if there's a warning flag we could potentially turn on that would diagnose such a mis-match ?
That's a good question. Similarly, I'm surprised neither gcc nor clang complains when a function is declared to return an enum but there's "return -20" somewhere (and -20 is NOT in the enum definition). I haven't found any such warning. These were spotted when trying to start libvirtd built with UBSAN.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Merged, thanks. Michal