Skip to contentSkip to conversation

fix memory corruption from misinterpreted bad_inode_ops return values

PATCH Bodo Eggert 1 participant 1 message Jan 5, 2007 14 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw
Quoted 9 lines · Eric Sandeen

Review

Quoted 4 lines · Andrew Morton

+++ a/fs/bad_inode.c

(quoted diff) +1 -1
-static int return_EIO(void)
+static long return_EIO(void)

What about ops that return loff_t (64 bits) on 32-bit arches and stuff it into 2 registers....

*If* it uses an additional register for the high bits, it will set e.g.:
EDX << 32 | EAX == (s64) -EIO
and therefore
EAX == -EIO // < -MAXLONGINT-1
EDX == -1

EAX will be the return register for s32. Therefore you can use one function for both cases on i386:

long long f()

{
        return -42;
}

long (*l )() = (void*)f; // hide warning
long long (*ll)() = f;

int main(){
        printf("%ld %lld\n", l(), ll());
}
Quoted 1 line

I'm still not convinced that this is the best place to be clever :)

ACK, not too clever, but not too stupid, too. Having #ifdef I386 etc. isn't nice, and something like this shouldn't be arch-specific. OTOH, C calling convention allows having a different argument signature, so you can safely use it. It's a feature.

Signature · 4 lines
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.

http://david.woodhou.se/why-not-spf.html