From: sashiko-bot@kernel.org
To: "Alberto Faria" <afaria@redhat.com>
Cc: virtualization@lists.linux.dev,
"Michael S. Tsirkin" <mst@redhat.com>,
"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v2 2/2] vdpa_sim_blk: add support for FUA writes
Date: Wed, 25 Nov 2026 08:05:50 +0000 [thread overview]
Message-ID: <sashiko-outbox-232862@kernel.org> (raw)
In-Reply-To: <20261125075408.226762-3-afaria@redhat.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] vdpa_sim: vdpasim_create() clobbers ret with 0, returning
NULL on error
--
commit 44caf7459577594a98fabfacf52e1c5c4e5f2cf1
Author: Alberto Faria <afaria@redhat.com>
vdpa_sim_blk: add support for FUA writes
This commit adds a validate_features callback to vdpasim_dev_attr and
exposes VIRTIO_BLK_F_REQ_FLAGS and VIRTIO_BLK_F_REQ_FLAGS_OUT_FUA in
vdpa_sim_blk.
> diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> index 97d437d89524a..888ea80f6e0af 100644
> --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
> @@ -209,6 +209,12 @@ struct vdpasim *vdpasim_create(struct vdpasim_dev_attr *dev_attr,
> if (config->device_features &
> ~dev_attr->supported_features)
> return ERR_PTR(-EINVAL);
> + if (dev_attr->validate_features) {
> + ret = dev_attr->validate_features(
> + config->device_features);
> + if (ret)
> + return ERR_PTR(ret);
> + }
> dev_attr->supported_features =
> config->device_features;
> }
[Severity: Medium]
Can assigning the return value of dev_attr->validate_features() to ret
cause vdpasim_create() to return NULL instead of an error pointer on later
failures?
ret is initialized to -ENOMEM at the start of vdpasim_create() for the
allocation and dma_set_mask_and_coherent() failure paths that jump to
err_iommu without setting ret. When validate_features() succeeds, it
overwrites ret with 0, so a later allocation failure frees dev and returns
ERR_PTR(0) (NULL), causing callers such as vdpasim_blk_dev_add() that only
check IS_ERR(simdev) to dereference NULL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125075408.226762-1-afaria@redhat.com?part=2
prev parent reply other threads:[~2026-11-25 8:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 7:54 [PATCH v2 0/2] virtio_blk: add FUA write support Alberto Faria
2026-11-25 7:54 ` [PATCH v2 1/2] virtio_blk: add fua " Alberto Faria
2026-11-25 8:09 ` sashiko-bot
2026-11-25 7:54 ` [PATCH v2 2/2] vdpa_sim_blk: add support for FUA writes Alberto Faria
2026-11-25 8:05 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-232862@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=afaria@redhat.com \
--cc=eperezma@redhat.com \
--cc=mst@redhat.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox