2021年3月8日(月) 22:38 Peter Maydell <peter.mayd...@linaro.org>: > > The online defect viewer is a bit better for showing why it thought > something was an issue. In this case we have at the top of the function: > > trace_gd_switch(vc->label, > surface ? surface_width(surface) : 0, > surface ? surface_height(surface) : 0); > > which tests whether surface is NULL, implying that sometimes it is. > > Then later we have: > if (vc->gfx.ds && surface && > > also checking surface for NULL-ness. > > Finally we have: > if (surface->format == PIXMAN_x8r8g8b8) { > > which dereferences surface without checking if it's NULL. > > So there is definitely a bug here: > (1) either surface can never be NULL, and all the places where > the function is testing for NULL-ness are wrong and need to be removed > (2) or surface can be NULL, and we should check here too > > Coverity can't tell us which of the two possibilities is right, of course. > > thanks > -- PMM
c821a58ee7 ("ui/console: Pass placeholder surface to display") intended to eliminate the possibility that surface is NULL, so (1) is the case. I am preparing a patch to remove NULL checks. Thanks, Akihiko Odaki