[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH 17/23] Add check for dm_snprintf result



>  		/* If the VG name is empty then lock the unused PVs */
> -		if (is_orphan_vg(resource) || is_global_vg(resource) || (flags & LCK_CACHE))
> -			dm_snprintf(lockname, sizeof(lockname), "P_%s",
> -				    resource);
> -		else
> -			dm_snprintf(lockname, sizeof(lockname), "V_%s",
> -				    resource);
> +		if (dm_snprintf(lockname, sizeof(lockname), "%c_%s",
> +				(is_orphan_vg(resource) ||
> +				 is_global_vg(resource) ||
> +				 (flags & LCK_CACHE)) ?  'P' : 'V',
> +				resource)  < 0) {
> +			log_error("Locking resource %s too long.", resource);
> +			return 0;
> +		}

I cannot imagine how this can happen. First parm is fixed char, second is resource string
with exact length. And char lockname[PATH_MAX];

Should we check for glibc and clompiler bugs also? :)

Well, isn't return_0 here enough?

Milan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]