[Spice-devel] [linux/vd-agent v1 5/7] coverity: allow pass by value with XEvent

Victor Toso victortoso at redhat.com
Mon Jul 15 09:43:33 UTC 2019


On Mon, Jul 15, 2019 at 05:16:03AM -0400, Frediano Ziglio wrote:
> > Subject: [Spice-devel] [linux/vd-agent v1 5/7] coverity: allow pass by value with XEvent
> 
> I would say that this patch is ignoring a warning, the code is
> compiling.

Hmm, I can rewrite shortlog but my feeling is that allowing
something means that wasn't that great but you allow it, not too
far from ignoring the problem, that is, both ways of saying this
are similar to me.

> > 
> > From: Victor Toso <me at victortoso.com>
> > 
> > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > ---
> >  src/vdagent/x11-randr.c | 4 ++--
> >  src/vdagent/x11.c       | 1 +
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/vdagent/x11-randr.c b/src/vdagent/x11-randr.c
> > index d000e28..924f5ec 100644
> > --- a/src/vdagent/x11-randr.c
> > +++ b/src/vdagent/x11-randr.c
> > @@ -528,8 +528,8 @@ void vdagent_x11_randr_handle_root_size_change(struct
> > vdagent_x11 *x11,
> >      }
> >  }
> >  
> > -int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
> > -    XEvent event)
> > +/* coverity[pass_by_value] */
> > +int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11, XEvent event)
> >  {
> >      int handled = TRUE;
> >  
> > diff --git a/src/vdagent/x11.c b/src/vdagent/x11.c
> > index c2515a8..90d08a1 100644
> > --- a/src/vdagent/x11.c
> > +++ b/src/vdagent/x11.c
> > @@ -494,6 +494,7 @@ static int vdagent_x11_get_clipboard_selection(struct
> > vdagent_x11 *x11,
> >  }
> >  #endif
> >  
> > +/* coverity[pass_by_value] */
> >  static void vdagent_x11_handle_event(struct vdagent_x11 *x11, XEvent event)
> >  {
> >      int i, handled = 0;
> 
> Have you though about converting to "const XEvent*" ?
> The structure is not that small.

I did but wasn't sure this was worth the effort? Wayland > X11,
risk of regressions, etc. If you fee this is worth, I can work on
it too.

Thanks,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190715/5fa7a678/attachment.sig>


More information about the Spice-devel mailing list