[PATCH 3/5] Ensure first is not NULL before dereference

Alasdair G Kergon <[email protected]>
Newsgroups dev.linux.lists.lvm-devel
Message-ID <[email protected]>
On Tue, Oct 26, 2010 at 02:59:24PM +0200, Zdenek Kabelac wrote:
> +	if (!first) {
> +		log_error(INTERNAL_ERROR "Unexpected empty PV list.");
> +		return 0;

We already have a 'list empty' check prior to calling this function.

I think it's more readable with the check in the caller and the
comment inside the function, instead of moving the check inside
the function.

No need to change this that I can see.

What is the code path that could trigger this condition?
(It's a static function only called from one place.)

What am I missing?

Alasdair
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.