Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297654

Re: [PATCH] cgroup: Fix uninitialized variable warning

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] cgroup: Fix uninitialized variable warning
Date 2015-12-23 22:40 +0100
Message-ID <qIZiy-6pz-17@gated-at.bofh.it> (permalink)
References <qIZiy-6pz-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello, Ross.

On Wed, Dec 23, 2015 at 02:30:40PM -0700, Ross Zwisler wrote:
>  static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
>  {
>  	struct cgroup_subsys_state *css;
> -	struct mem_cgroup *memcg;
> +	struct mem_cgroup *memcg = NULL;

It's one thing to add spurious init to shut up gcc

> @@ -4805,7 +4805,7 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
>  		p = leader;
>  		memcg = mem_cgroup_from_css(css);
>  	}
> -	if (!p)
> +	if (!p || !memcg)

and to another to add an additional processing on it.

Please note which gcc version you were using in the commit description
and mark the init with a comment.

Thanks.

-- 
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] cgroup: Fix uninitialized variable warning Tejun Heo <tj@kernel.org> - 2015-12-23 22:40 +0100

csiph-web