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

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

 



On Mon, Apr 13, 2015 at 01:25:15PM +0200, Peter Senna Tschudin wrote:
> 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;

I don't know about "bug" but it does look uninentional, yes.

Double casting is probably a good thing to print a static checker
warning about.

Other static checkers complain about:

1)	~(char)foo;

	(char)foo is type promoted to an int before the bitwise NOT.

2)	(long *)&some_int

3)	some_function((struct foo *)ptr);

	Casting function arguments is almost always wrong.  I check this
	with Smatch.  I don't remember the details.

4)	(long long)(x + y)

	Probably it should be (long long)x + y

regards,
dan carpenter

_______________________________________________
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