Skip to contentSkip to conversation

usb: usbtmc: Add vendor specific/asynchronous read/write ioctls

PATCH New Greg Kroah-Hartman 1 participant 1 message May 18, 2018 USB

lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

PATCH 6/12 usb: usbtmc: Add vendor specific/asynchronous read/write ioctls

Review

Quoted 13 lines · Guido Kiener
(quoted diff) +13 -0
+/*
+ * usbtmc_message->flags:
+ */
+#define USBTMC_FLAG_ASYNC		0x0001
+#define USBTMC_FLAG_APPEND		0x0002
+#define USBTMC_FLAG_IGNORE_TRAILER	0x0004
+
+struct usbtmc_message {
+	void __user *message; /* pointer to header and data */
+	__u64 transfer_size; /* size of bytes to transfer */
+	__u64 transferred; /* size of received/written bytes */
+	__u32 flags; /* bit 0: 0 = synchronous; 1 = asynchronous */
+} __attribute__ ((packed));

Very odd structure. Your userspace pointer is going to be totally out of alignment on 32bit systems running on a 64bit kernel. Why have a separate pointer at all? Why not just put the mesage at the end of this structure directly with something like:

	__u8 message[0];

?

Much easier and you don't have to mess with the whole compatible ioctl thunking layer (which I think you ignored here, which means you all didn't test it...)

thanks,

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html