[lvm-devel] [PATCH 18/29] Check result of vginfo_from_vgname

Alasdair G Kergon agk at redhat.com
Mon Nov 29 20:56:58 UTC 2010


On Thu, Nov 25, 2010 at 11:55:22AM +0100, Zdenek Kabelac wrote:
> Keep static code analyzers happier. In this case there is a very small
> chance bug could appear (memory fault?). 

Our code doesn't attempt to protect against memory faults!

We are entitled to assume the orphan VGs are always there, so if they
aren't it's an internal error, yes.

>  			dm_list_iterate_items_safe(info2, info3, &primary_vginfo->infos) {
>  				orphan_vginfo = vginfo_from_vgname(primary_vginfo->fmt->orphan_vg_name, NULL);
> +				if (!orphan_vginfo) {
> +					log_error(INTERNAL_ERROR "vginfo for orphan_vg_name failed.");

Which orphan VG?  If this failed, I'd want to know what it was trying to look up!
INTERNAL_ERROR "Orphan vginfo %s lost from cache."

Ack with a more-useful error message.

Alasdair




More information about the lvm-devel mailing list