lkml.org 
[lkml]   [2007]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [UPDATED PATCH] fix memory corruption from misinterpreted bad_inode_ops return values
Date
Eric Sandeen <sandeen@redhat.com> wrote:
> Andrew Morton wrote:

>> +++ a/fs/bad_inode.c

>> -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());
}

> 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.
--
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-01-05 17:41    [W:0.029 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site