[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84343571-2b89-4fa1-8b52-5b6ff1d33e88@kernel.org>
Date: Sat, 29 Nov 2025 15:31:52 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Stefan Hajnoczi <stefanha@...hat.com>, linux-block@...r.kernel.org
Cc: "Martin K. Petersen" <martin.petersen@...cle.com>,
linux-kernel@...r.kernel.org,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
Mike Christie <michael.christie@...cle.com>, Jens Axboe <axboe@...nel.dk>,
linux-nvme@...ts.infradead.org, Keith Busch <kbusch@...nel.org>,
Sagi Grimberg <sagi@...mberg.me>, linux-scsi@...r.kernel.org,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH 3/4] block: add IOC_PR_READ_KEYS ioctl
On 26/11/2025 17:35, Stefan Hajnoczi wrote:
> +
> #define PR_FL_IGNORE_KEY (1 << 0) /* ignore existing key */
>
> #define IOC_PR_REGISTER _IOW('p', 200, struct pr_registration)
> @@ -64,5 +70,6 @@ struct pr_clear {
> #define IOC_PR_PREEMPT _IOW('p', 203, struct pr_preempt)
> #define IOC_PR_PREEMPT_ABORT _IOW('p', 204, struct pr_preempt)
> #define IOC_PR_CLEAR _IOW('p', 205, struct pr_clear)
> +#define IOC_PR_READ_KEYS _IOWR('p', 206, struct pr_read_keys)
>
> #endif /* _UAPI_PR_H */
> diff --git a/block/ioctl.c b/block/ioctl.c
> index d7489a56b33c3..e87c424c15ae9 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -1,5 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0
> #include <linux/capability.h>
> +#include <linux/cleanup.h>
> #include <linux/compat.h>
> #include <linux/blkdev.h>
> #include <linux/export.h>
> @@ -423,6 +424,54 @@ static int blkdev_pr_clear(struct block_device *bdev, blk_mode_t mode,
> return ops->pr_clear(bdev, c.key);
> }
>
> +static int blkdev_pr_read_keys(struct block_device *bdev, blk_mode_t mode,
> + struct pr_read_keys __user *arg)
> +{
> + const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops;
> + struct pr_keys *keys_info __free(kfree) = NULL;
This is an undesired syntax explicitly documented as one to avoid. You
need here proper assignment, not NULL. Please don't use cleanup.h if you
do not intend to follow it because it does not make the code simpler.
Best regards,
Krzysztof
Powered by blists - more mailing lists