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