Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Akihiko Odaki
2021年3月8日(月) 23:58 Christian Schoenebeck : > > Yes, but the optimizer part could be disabled with > -fno-delete-null-pointer-checks which would render it a pure diagnostic > feature: > > https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-nonnull-function-attribute > > Is there

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Christian Schoenebeck
On Montag, 8. März 2021 15:30:23 CET Philippe Mathieu-Daudé wrote: > On 3/8/21 3:17 PM, Akihiko Odaki wrote: > > 2021年3月8日(月) 23:03 Christian Schoenebeck : > >> BTW, there is __nonnull supported by clang, e.g.: > >> > >> static void foo(void *__nonnull p) { > >> > >> ... > >> > >> } > >>

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Akihiko Odaki
2021年3月8日(月) 22:38 Peter Maydell : > > 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, >

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Philippe Mathieu-Daudé
On 3/8/21 3:17 PM, Akihiko Odaki wrote: > 2021年3月8日(月) 23:03 Christian Schoenebeck : >> >> BTW, there is __nonnull supported by clang, e.g.: >> >> static void foo(void *__nonnull p) { >> ... >> } >> >> Maybe as an optionally defined macro (if supported by compiler) this could be >> a useful

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Akihiko Odaki
2021年3月8日(月) 23:03 Christian Schoenebeck : > > BTW, there is __nonnull supported by clang, e.g.: > > static void foo(void *__nonnull p) { > ... > } > > Maybe as an optionally defined macro (if supported by compiler) this could be > a useful tool for such intended nonnull designs, as it imme

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Christian Schoenebeck
On Montag, 8. März 2021 14:37:44 CET Peter Maydell wrote: > On Mon, 8 Mar 2021 at 13:32, Christian Schoenebeck > > wrote: > > On Montag, 8. März 2021 12:31:33 CET Akihiko Odaki wrote: > > > 2021年3月8日(月) 19:39 Christian Schoenebeck : > > > > This was just about silencing the mentioned automated Co

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Peter Maydell
On Mon, 8 Mar 2021 at 13:32, Christian Schoenebeck wrote: > > On Montag, 8. März 2021 12:31:33 CET Akihiko Odaki wrote: > > 2021年3月8日(月) 19:39 Christian Schoenebeck : > > > This was just about silencing the mentioned automated Coverity defects > > > report. If you have a better solution, then just

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Christian Schoenebeck
On Montag, 8. März 2021 12:31:33 CET Akihiko Odaki wrote: > 2021年3月8日(月) 19:39 Christian Schoenebeck : > > This was just about silencing the mentioned automated Coverity defects > > report. If you have a better solution, then just ignore this patch. > > > > Best regards, > > Christian Schoenebeck

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Akihiko Odaki
2021年3月8日(月) 21:42 Christian Schoenebeck : > > Unfortunately Coverity's defects reports are not very verbose. In this case: > > *** CID 1448421:(FORWARD_NULL) > /qemu/ui/gtk.c: 570 in gd_switch() > 564 surface_width(vc->gfx.ds) == surface_width(surface) && > 565 surface_

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Akihiko Odaki
2021年3月8日(月) 19:39 Christian Schoenebeck : > > This was just about silencing the mentioned automated Coverity defects report. > If you have a better solution, then just ignore this patch. > > Best regards, > Christian Schoenebeck > > I do not have an access to Coverity defects report. I'd apprecia

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-08 Thread Christian Schoenebeck
On Montag, 8. März 2021 04:45:24 CET Akihiko Odaki wrote: > 2021年3月8日(月) 4:57 Christian Schoenebeck : > > DisplaySurface pointer passed to gd_switch() can be NULL, so check this > > before trying to dereference it. > > > > Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to display") > > R

Re: [PATCH] ui/gtk: fix NULL pointer dereference

2021-03-07 Thread Akihiko Odaki
2021年3月8日(月) 4:57 Christian Schoenebeck : > > DisplaySurface pointer passed to gd_switch() can be NULL, so check this > before trying to dereference it. > > Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to display") > Reported-by: Coverity (CID 1448421) > Signed-off-by: Christian Schoene

[PATCH] ui/gtk: fix NULL pointer dereference

2021-03-07 Thread Christian Schoenebeck
DisplaySurface pointer passed to gd_switch() can be NULL, so check this before trying to dereference it. Fixes: c821a58ee7 ("ui/console: Pass placeholder surface to display") Reported-by: Coverity (CID 1448421) Signed-off-by: Christian Schoenebeck --- ui/gtk.c | 4 ++-- 1 file changed, 2 inserti