On 3/19/26 08:30, Christian König wrote: > Hi guys, > > well when mesa leaves some fields in the structure uninitialized then that is > a pretty bad idea and we should eventually fix that. > > But always setting the pointers to valid arrays and just setting the number > of array elements to zero is perfectly valid. > > That doesn't even needs a debug message.
As discussed recently for another patch, the "(How to avoid) Botching up ioctls" page of the kernel documentation says under Basics: * Check all unused fields and flags and all the padding for whether it’s 0, and reject the ioctl if that’s not the case. That seems to apply here, i.e. the kernel should have these checks and Mesa should initialize the pointer field to 0 when the corresponding num_* field is. P.S. I agree it probably doesn't make a practical difference in this specific case. I suspect the rule is aimed at when the ioctl struct is extended, in which case Mesa's current behaviour would be indistinguishable from user-space code which actually doesn't properly initialize the newly-added fields. It seems safer to stick to the rule even in cases like this where it's not strictly required. -- Earthling Michel Dänzer \ GNOME / Xwayland / Mesa developer https://redhat.com \ Libre software enthusiast
