Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751722AbcLEQhZ (ORCPT ); Mon, 5 Dec 2016 11:37:25 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:34723 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751161AbcLEQhX (ORCPT ); Mon, 5 Dec 2016 11:37:23 -0500 Date: Mon, 5 Dec 2016 08:37:18 -0800 From: Stephen Hemminger To: Pan Bian Cc: "David S. Miller" , bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] net: bridge: set error code on failure Message-ID: <20161205083718.0c0daa1a@xeon-e3> In-Reply-To: <1480764803-5577-1-git-send-email-bianpan2016@163.com> References: <1480764803-5577-1-git-send-email-bianpan2016@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1005 Lines: 30 On Sat, 3 Dec 2016 19:33:23 +0800 Pan Bian wrote: > Function br_sysfs_addbr() does not set error code when the call > kobject_create_and_add() returns a NULL pointer. It may be better to > return "-ENOMEM" when kobject_create_and_add() fails. > > Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188781 > > Signed-off-by: Pan Bian > --- > net/bridge/br_sysfs_br.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c > index e120307..f88c4df 100644 > --- a/net/bridge/br_sysfs_br.c > +++ b/net/bridge/br_sysfs_br.c > @@ -898,6 +898,7 @@ int br_sysfs_addbr(struct net_device *dev) > if (!br->ifobj) { > pr_info("%s: can't add kobject (directory) %s/%s\n", > __func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR); > + err = -ENOMEM; > goto out3; > } > return 0; Makes sense. Although such a small allocation should never fail. Acked-by: Stephen Hemminger