From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Date: Tue, 23 Mar 2010 03:31:13 +0000 Subject: Re: [patch] kcore: fix test for end of list Message-Id: <20100322233113.f17d0e0c.akpm@linux-foundation.org> List-Id: References: <20100322120509.GC21571@bicker> In-Reply-To: <20100322120509.GC21571@bicker> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter Cc: KAMEZAWA Hiroyuki , WANG Cong , Jiri Slaby , Jaswinder Singh Rajput , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org On Mon, 22 Mar 2010 15:05:09 +0300 Dan Carpenter wrote: > "m" is never NULL here. We need a different test for the end of list > condition. > > Signed-off-by: Dan Carpenter > --- > Found with a static checker and compile tested only. Please review > carefully. > > diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c > index a44a789..b442dac 100644 > --- a/fs/proc/kcore.c > +++ b/fs/proc/kcore.c > @@ -490,7 +490,7 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos) > } > read_unlock(&kclist_lock); > > - if (m = NULL) { > + if (&m->list = &kclist_head) { > if (clear_user(buffer, tsz)) > return -EFAULT; > } else if (is_vmalloc_or_module_addr((void *)start)) { hm, that code's been there for five years. I wonder if it's actually necessary.