The following test program illustrates the memory corruption.  You
would hope foo.b would be 42 but it is corrupted to -1.

#include <stdio.h>
#include <limits.h>

struct foo {
        int a, b;
};

void kstrtol(long *x)
{
        *x = -1;
}

int main(void)
{
        struct foo foo;

        foo.b = 42;
        kstrtol((long *)&foo.a);
        printf("%d %d\n", foo.a, foo.b);
        return 0;
}

The error handling should return an error, it shouldn't just print
something.  It shouldn't print anything actually, it should just
handle the error without printing or complaining.  :P

regards,
dan carpenter

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to