qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-block] [PATCH v5 2/4] raw: Recognize zoned backin


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v5 2/4] raw: Recognize zoned backing devices
Date: Wed, 28 Aug 2019 10:32:55 +0100
User-agent: Mutt/1.12.1 (2019-06-15)

On Fri, Aug 23, 2019 at 03:49:25PM -0400, Dmitry Fomichev wrote:
> +static int hdev_get_zoned_model(int fd)

Please use the enum:

  static BdrvZonedModel hdev_get_zoned_model(int fd)

> +{
> +#ifdef CONFIG_LINUX
> +    char buf[32];
> +    int ret;
> +
> +    ret = hdev_read_blk_queue_entry(fd, "zoned", buf, sizeof(buf));
> +    if (ret < 0) {
> +        ret = BLK_ZONED_MODEL_NONE;
> +        goto out;
>      }
> -    g_free(sysfspath);
> +
> +    buf[ret - 1] = 0;

The ret - 1 looks suspicious since sg_get_max_segments() does buf[ret] =
0 instead.  A comment would make it clear why ret - 1 is used here:

  buf[ret - 1] = 0; /* strip newline and NUL-terminate */

Attachment: signature.asc
Description: PGP signature


reply via email to

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