linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* arch/powerpc/kernel/cacheinfo.c: Possible null pointer dereference
@ 2011-02-12 10:08 David Binderman
  2011-02-13 23:24 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: David Binderman @ 2011-02-12 10:08 UTC (permalink / raw)
  To: benh, paulus; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]


Hello there,

I just tried out cppcheck-1.47 on the linux-2.6.38-rc4 source code.

It said

[arch/powerpc/kernel/cacheinfo.c:380]: (error) Possible null pointer dereference: cache - otherwise it is redundant to check if cache is null at line 382

The source code is

    WARN_ONCE(cache && cache->level != level,
          "cache level mismatch on lookup (got %d, expected %d)\n",
          cache->level, level);

    if (!cache)

I agree with cppcheck. Suggest code rework.

Regards

David Binderman

 		 	   		  

[-- Attachment #2: Type: text/html, Size: 913 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-13 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-12 10:08 arch/powerpc/kernel/cacheinfo.c: Possible null pointer dereference David Binderman
2011-02-13 23:24 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).