Re: Make checkpatch warn about pointless casting of kalloc returns.

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

 



+# check for pointless casting of kmalloc return
+		if ($rawline =~ /\*\)[ ]k[czm]alloc/) {

It looks to me like this will catch

foo = (char *) kmalloc(512);

but not

for = (char* )kmalloc(512);

I haven't tried it but how about something like:

if($rawline =~/\(.*\)\s*k[czm]alloc/){

which if I got it right should match the typecast with any combination of spacing.

+			WARN("No need to cast return value.\n");

Could the warning be more descriptive? This describes what, but it should also describe why; after all if somebody made this error they may not know they why.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux