Re: [PATCH] Fix pointer cast for 32 bits arch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Line 4677 of http://pastebin.com/2bi9Dg7k looks like a bug

diff -u -p a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
-       regs->nip = (unsigned long) (unsigned long)ksig->ka.sa.sa_handler;

On Mon, Apr 13, 2015 at 1:21 PM, Geert Uytterhoeven
<geert@xxxxxxxxxxxxxx> wrote:
> Hi Peter,
>
> On Mon, Apr 13, 2015 at 1:14 PM, Peter Senna Tschudin
> <peter.senna@xxxxxxxxx> wrote:
>>> Perhaps checkpatch should complain about casts outside header files?
>> Cocinelle found 664 double casts:
>> http://pastebin.com/2bi9Dg7k
>>
>> and 9 triple casts:
>> http://pastebin.com/RkJhPTTV
>
> I think double casts are only needed when casting between integers
> and pointers of different sizes:
>   1. One cast to make the sizes match,
>   2. One cast to convert between pointer and integer.
>
> I think triple casts can always be simplified.
> Or am I missing some use cases?
>
>> Those are 'not' patches, just the output of Coccinelle for analysis.
>> The .cocci for triple cast:
>> @@
>> expression e1, e2;
>> type t1, t2, t3;
>> @@
>> e1 =
>> - (t1)(t2)(t3)
>> e2
>>
>> So if there are cast patterns known to be wrong, it is easy to find
>> and probably fix them with Coccinelle.
>
> It depends on the original type and on the destination type.
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds



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




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux