Thread (45 messages) 45 messages, 12 authors, 2010-09-03

Re: [PATCH 06/19] Add ioctl() argument and attribute handling utils

From: Stefan Richter <stefanr@s5r6.in-berlin.de>
Date: 2010-08-20 12:59:26
Also in: lkml

Miloslav Trmač wrote:
quoted hunk ↗ jump to hunk
--- /dev/null
+++ b/crypto/userspace/utils.c
[...]
+#ifdef CONFIG_COMPAT
+/* max() is too clever for compile-time constants */
+#define CONST_MAX(A, B) ((A) > (B) ? (A) : (B))
+
+#define MAX_SESSION_INPUT_DATA_SIZE					\
+	(CONST_MAX(sizeof(struct ncr_session_input_data),		\
+		   sizeof(struct compat_ncr_session_input_data)))
+#define MAX_SESSION_OUTPUT_BUFFER_SIZE					\
+	(CONST_MAX(sizeof(struct ncr_session_output_buffer),		\
+		   sizeof(struct compat_ncr_session_output_buffer)))
+
+#else /* !CONFIG_COMPAT */
+
+#define MAX_SESSION_INPUT_DATA_SIZE (sizeof(struct ncr_session_input_data))
+#define MAX_SESSION_OUTPUT_BUFFER_SIZE			\
+	(sizeof(struct ncr_session_output_buffer))
+
+#endif /* !CONFIG_COMPAT */
struct compat_xyz cannot be bigger than struct xyz, can it?
-- 
Stefan Richter
-=====-==-=- =--- =-=--
http://arcgraph.de/sr/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help