From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752436AbcFUSS4 (ORCPT ); Tue, 21 Jun 2016 14:18:56 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:60852 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbcFUSSz (ORCPT ); Tue, 21 Jun 2016 14:18:55 -0400 Date: Tue, 21 Jun 2016 14:14:04 -0400 From: Johannes Weiner To: Tejun Heo Cc: Li Zefan , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH cgroup/for-4.8] cgroup: allow NULL return from ss->css_alloc() Message-ID: <20160621181404.GB4501@cmpxchg.org> References: <20160621170624.GK3262@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160621170624.GK3262@mtj.duckdns.org> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 21, 2016 at 01:06:24PM -0400, Tejun Heo wrote: > cgroup core expected css_alloc to return an ERR_PTR value on failure > and caused NULL deref if it returned NULL. It's an easy mistake to > make from an alloc function and there's no ambiguity in what's being > indicated. Update css_create() so that it interprets NULL return from > css_alloc as -ENOMEM. > > Signed-off-by: Tejun Heo Would it be better to remove the error code instead and have everybody return NULL? AFAICS, everybody is returning either the object or the -ENOMEM error code right now. What error condition is there for an allocation function?