i965: Check return value of screen->image.loader->getBuffers (v2)
authorTomasz Figa <tfiga@chromium.org>
Mon, 13 Jun 2016 10:53:21 +0000 (19:53 +0900)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 14 Jun 2016 14:32:04 +0000 (15:32 +0100)
commite7ab358e8186dd8651cf920d4db1500c60ccd2fc
tree48d7a3455f05237ec14efbd1f043815ea0a6144d
parent9ee3f097b65398250e836785a7e87520eda8298d
i965: Check return value of screen->image.loader->getBuffers (v2)

The images struct is an uninitialized local variable on the stack. If the
callback returns 0, the struct might not have been updated and so should
be considered uninitialized. Currently the code ignores the return value,
which (depending on stack contents) might end up in reading a non-zero
value from images.image_mask and dereferencing further fields.

Another solution would be to initialize image_mask with 0, but checking
the return value seems more sensible and it is what Gallium is doing.

v2: fix typos in commit message,
    fix indentation,
    remove unnecessary parentheses and pointer dereference to keep line
    length reasonable.

Cc: 11.2 12.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/mesa/drivers/dri/i965/brw_context.c