[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251016071115.GH1417@lst.de>
Date: Thu, 16 Oct 2025 09:11:15 +0200
From: Christoph Hellwig <hch@....de>
To: Johannes Thumshirn <johannes.thumshirn@....com>
Cc: axboe@...nel.dk, chaitanyak@...dia.com, dlemoal@...nel.org,
hare@...e.de, hch@....de, john.g.garry@...cle.com,
linux-block@...r.kernel.org, linux-btrace@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
martin.petersen@...cle.com, mathieu.desnoyers@...icios.com,
mhiramat@...nel.org, naohiro.aota@....com, rostedt@...dmis.org,
shinichiro.kawasaki@....com
Subject: Re: [PATCH v3 16/16] blktrace: handle BLKTRACESETUP2 ioctl
> +static int blk_trace_setup2(struct request_queue *q, char *name, dev_t dev,
> + struct block_device *bdev, char __user *arg)
> +{
> + struct blk_user_trace_setup2 buts2;
> + struct blk_trace *bt;
> + int ret;
> +
> + ret = copy_from_user(&buts2, arg, sizeof(buts2));
> + if (ret)
> + return -EFAULT;
You can simplify this to the more usual:
if (copy_from_user(&buts2, arg, sizeof(buts2)))
return -EFAULT;
> +
> + if (!buts2.buf_size || !buts2.buf_nr)
> + return -EINVAL;
This should probably also check that nothing is set in the flags field
so that it can be used for backwards compatible extensions?
Powered by blists - more mailing lists