qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/3] scsi-disk: Implement 'REPORT TARGET PORT GR


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH 3/3] scsi-disk: Implement 'REPORT TARGET PORT GROUPS'
Date: Wed, 25 Nov 2015 15:55:57 +0800
User-agent: Mutt/1.5.23 (2015-06-09)

On Mon, Nov 16, 2015 at 03:36:58PM +0100, Hannes Reinecke wrote:
> +    /* Enable TGPS bit */
> +    if (s->wwn)
> +        outbuf[4] = 1;

QEMU coding style: Please always use curly braces, even if the if
statement body is just one line.

> +static void qdev_enumerate_port_group(PortGroupEnumerate *pg, DeviceState 
> *dev)
> +{
> +    BusState *child;
> +
> +    if (!strcmp(object_get_typename(OBJECT(dev->parent_bus)), 
> TYPE_SCSI_BUS)) {

object_dynamic_cast(OBJECT(dev->parent_bus), TYPE_SCSI_BUS) is shorter
and doesn't require the explicit strcmp().

> +static int scsi_emulate_report_target_port_groups(SCSIDiskState *s, uint8_t 
> *inbuf)

"inbuf" seems to be an output buffer rather than an input buffer.  The
name "outbuf" would be clearer.

How does this function protect against buffer overflow?  It's not
obvious how we guarantee the output buffer is large enough.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]