Re: BUG/PATCH: include/asm-*/fcntl.h

From: Albert D. Cahalan (
Date: Sat Aug 26 2000 - 01:01:00 EST

Bernd Kischnick writes:

> An hour ago I posted a patch for asm-ppc/fcntl.h.
> Now I scanned the other asm-directories and found the same bug in
> +struct flock64 {
> + short l_type;
> + short l_whence;
> + loff_t l_start;
> + loff_t l_len;
> + pid_t l_pid;


Your struct likely looks like this on some systems:

2 bytes l_type
2 bytes l_whence
4 bytes COMPILER GENERATED CRAP <-- Eeew, gross.
8 bytes l_start
8 bytes l_len
4 bytes l_pid

You didn't follow the rules. (Remember that flamewar?)
You waste space and, maybe, leak secret data out of the kernel.
(if you copy the whole thing, with uninitialized data...)

After you fix the alignment, mind leaving some spare bytes?
It really sucks increasing these structs all the time.
Just define an explicit __u32 after l_whence to align things.
(of course, any padding or spares must be cleared)

For any gcc hacker reading this: we NEED a warning for alignment
problems of this sort. Ideally it would complain about the above
even with an ABI that allows 32-bit alignment of "long long".

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:17 EST