Thread (26 messages) 26 messages, 4 authors, 2025-10-22

Re: [PATCH v4 6/7] nvme-tcp: Allow userspace to trigger a KeyUpdate with debugfs

From: Christoph Hellwig <hch@lst.de>
Date: 2025-10-17 04:32:03
Also in: linux-doc, linux-nfs, linux-nvme, lkml

On Fri, Oct 17, 2025 at 02:23:11PM +1000, alistair23@gmail.com wrote:
+#ifdef CONFIG_NVME_TCP_TLS
+#define NVME_DEBUGFS_RW_ATTR(field) \
+	static int field##_open(struct inode *inode, struct file *file) \
+	{ return single_open(file, field##_show, inode->i_private); } \
Please use normal indentation in the macro, but do not add an extra
level of indentation just for being inside a macro.

Then again the macro is only used once anyway, so why add it at all?
+static ssize_t nvme_ctrl_key_update_write(struct file *file, const char __user *buf,
Please avoid the overly long line.
+					  size_t count, loff_t *ppos)
+{
+	struct seq_file *m = file->private_data;
+	struct nvme_ctrl *nctrl = m->private;
+	struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
+	char kbuf[16] = {0};
+	int queue_nr, rc;
+	struct nvme_tcp_queue *queue;
+
+	if (count > sizeof(kbuf) - 1)
+		return -EINVAL;
+	if (copy_from_user(kbuf, buf, count))
+		return -EFAULT;
+	kbuf[count] = 0;
+
+	rc = kstrtouint(kbuf, 10, &queue_nr);
+	if (rc)
+		return rc;
kstrtoint_from_user?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help