lkml.org 
[lkml]   [2014]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arch: cris: arch-v32: drivers: axisflashmap.c: Cleaning up inconsistent NULL checks
On Fri, May 23, 2014 at 06:40:17PM +0200, Rickard Strandqvist wrote:
> Hej Jesper!

Tjo!

> But in several other place in the feature ensures that main_mtd is not NULL.
> (That's what cppcheck base their misjudgment on too)
>
> Then all these checks are unnecessary?

No, it is still necessary to check for NULL, however as I wrote in my reply,
we do check for ptable_head, which is only set if main_mtd is set.

> You should know, looks like you've written most of the code in 2007 :)
>
> Best regards
> Rickard Strandqvist

/Jesper

> 2014-05-23 9:00 GMT+02:00 Jesper Nilsson <jesper.nilsson@axis.com>:
> > On Fri, May 23, 2014 at 12:00:09AM +0200, Rickard Strandqvist wrote:
> >> Cleaning up inconsistent NULL checks.
> >> There is otherwise a risk of a possible null pointer dereference.
> >>
> >> Was largely found by using a static code analysis program called cppcheck.
> >
> > ... and is a false positive.
> >
> > We can't enter this if-block unless ptable_head is set,
> > which is only set if main_mtd is set.
> >
> > It might be useful to add it anyways, but there's a refactoring
> > needed for the axisflashmaps, so I'll keep it for then.
> >
> > /^JN - Jesper Nilsson
> > --
> > Jesper Nilsson -- jesper.nilsson@axis.com

/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson@axis.com


\
 
 \ /
  Last update: 2014-05-26 10:41    [W:0.058 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site