[lxc-devel] [PATCH 2/3] coverity: fix dereference NULL return value

Serge Hallyn serge.hallyn at ubuntu.com
Fri May 3 21:52:02 UTC 2013


Quoting Dwight Engen (dwight.engen at oracle.com):
> also break once we have found root, no need to search the rest of the mounts

I'm not sure about this.  There can be >1 entries for /.  Though when
I do

	lxc-unshare -s MOUNT -- /bin/sh
	  mount --rbind / /
	  mount --make-rshared /
The first / entry seems to become shared, which I wouldn't have
expected...  But I suspect there's a way to get a later entry
to be shared.

> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
> ---
>  src/lxc/conf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index 125e8a6..827626f 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -1067,10 +1067,11 @@ int detect_shared_rootfs(void)
>  		if (strcmp(p+1, "/") == 0) {
>  			// this is '/'.  is it shared?
>  			p = index(p2+1, ' ');
> -			if (strstr(p, "shared:")) {
> +			if (p && strstr(p, "shared:")) {
>  				fclose(f);
>  				return 1;
>  			}
> +			break;
>  		}
>  	}
>  	fclose(f);
> -- 
> 1.8.1.4
> 
> 
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite
> It's a free troubleshooting tool designed for production
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap2
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list