Hi Peter, > -----Original Message----- > From: Peter Maydell [mailto:[email protected]] > Sent: Saturday, April 28, 2018 12:15 AM > To: Michael S. Tsirkin <[email protected]> > Cc: QEMU Developers <[email protected]>; Gonglei (Arei) > <[email protected]>; longpeng <[email protected]>; Zhoujian (jay) > <[email protected]>; Paolo Bonzini <[email protected]> > Subject: Re: [PULL 10/13] cryptodev: add vhost-user as a new cryptodev > backend > > On 1 March 2018 at 16:46, Michael S. Tsirkin <[email protected]> wrote: > > From: Gonglei <[email protected]> > > > > Usage: > > -chardev socket,id=charcrypto0,path=/path/to/your/socket > > -object cryptodev-vhost-user,id=cryptodev0,chardev=charcrypto0 > > -device virtio-crypto-pci,id=crypto0,cryptodev=cryptodev0 > > > > Signed-off-by: Gonglei <[email protected]> > > Signed-off-by: Longpeng(Mike) <[email protected]> > > Signed-off-by: Jay Zhou <[email protected]> > > Reviewed-by: Michael S. Tsirkin <[email protected]> > > Signed-off-by: Michael S. Tsirkin <[email protected]> > > Hi; Coverity (CID 1390600) points out that there's dead code in this function: > > > +static void cryptodev_vhost_user_event(void *opaque, int event) { > > + CryptoDevBackendVhostUser *s = opaque; > > + CryptoDevBackend *b = CRYPTODEV_BACKEND(s); > > + Error *err = NULL; > > We set err to NULL here... > > > + int queues = b->conf.peers.queues; > > + > > + assert(queues < MAX_CRYPTO_QUEUE_NUM); > > + > > + switch (event) { > > + case CHR_EVENT_OPENED: > > + if (cryptodev_vhost_user_start(queues, s) < 0) { > > + exit(1); > > + } > > + b->ready = true; > > + break; > > + case CHR_EVENT_CLOSED: > > + b->ready = false; > > + cryptodev_vhost_user_stop(queues, s); > > + break; > > + } > > ...and nothing here does anything with err... > > > + > > + if (err) { > > + error_report_err(err); > > + } > > ...so this if() is all dead code and we could remove err entirely.
Thanks for reporting this. I'll send a patch to fix it. Regards, Jay
