* [PATCH] IO{R,W,RW}_BAD
@ 2003-10-09 19:15 Matthew Wilcox
2003-10-10 8:36 ` Andreas Schwab
0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox @ 2003-10-09 19:15 UTC (permalink / raw)
To: linux-ia64
We need this patch to compile some drivers. It's a mirror of the patch
applied to i386 and other architectures.
Index: include/asm-ia64/ioctl.h
=================================RCS file: /var/cvs/linux-2.6/include/asm-ia64/ioctl.h,v
retrieving revision 1.1
diff -u -p -r1.1 ioctl.h
--- include/asm-ia64/ioctl.h 29 Jul 2003 17:01:57 -0000 1.1
+++ include/asm-ia64/ioctl.h 30 Sep 2003 22:23:28 -0000
@@ -54,11 +54,21 @@
((nr) << _IOC_NRSHIFT) | \
((size) << _IOC_SIZESHIFT))
+/* provoke compile error for invalid uses of size argument */
+extern int __invalid_size_argument_for_IOC;
+#define _IOC_TYPECHECK(t) \
+ ((sizeof(t) = sizeof(t[1]) && \
+ sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
+ sizeof(t) : __invalid_size_argument_for_IOC)
+
/* used to create numbers */
#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
-#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
-#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
-#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size)))
+#define _IOR_BAD(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
+#define _IOW_BAD(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
+#define _IOWR_BAD(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
/* used to decode ioctl numbers.. */
#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] IO{R,W,RW}_BAD
2003-10-09 19:15 [PATCH] IO{R,W,RW}_BAD Matthew Wilcox
@ 2003-10-10 8:36 ` Andreas Schwab
0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2003-10-10 8:36 UTC (permalink / raw)
To: linux-ia64
Matthew Wilcox <willy@debian.org> writes:
> We need this patch to compile some drivers. It's a mirror of the patch
> applied to i386 and other architectures.
>
> Index: include/asm-ia64/ioctl.h
> =================================> RCS file: /var/cvs/linux-2.6/include/asm-ia64/ioctl.h,v
> retrieving revision 1.1
> diff -u -p -r1.1 ioctl.h
> --- include/asm-ia64/ioctl.h 29 Jul 2003 17:01:57 -0000 1.1
> +++ include/asm-ia64/ioctl.h 30 Sep 2003 22:23:28 -0000
> @@ -54,11 +54,21 @@
> ((nr) << _IOC_NRSHIFT) | \
> ((size) << _IOC_SIZESHIFT))
>
> +/* provoke compile error for invalid uses of size argument */
> +extern int __invalid_size_argument_for_IOC;
> +#define _IOC_TYPECHECK(t) \
> + ((sizeof(t) = sizeof(t[1]) && \
> + sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
> + sizeof(t) : __invalid_size_argument_for_IOC)
This needs to be implemented differently. Glibc needs to include this
file for <sys/ioctl.h>, but the use of the undefined symbol will make it
impossible to compile without optimisation.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-10-10 8:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-09 19:15 [PATCH] IO{R,W,RW}_BAD Matthew Wilcox
2003-10-10 8:36 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox