Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbcLCLeM (ORCPT ); Sat, 3 Dec 2016 06:34:12 -0500 Received: from m50-133.163.com ([123.125.50.133]:49263 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbcLCLeK (ORCPT ); Sat, 3 Dec 2016 06:34:10 -0500 From: Pan Bian To: Stephen Hemminger , "David S. Miller" , bridge@lists.linux-foundation.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] net: bridge: set error code on failure Date: Sat, 3 Dec 2016 19:33:23 +0800 Message-Id: <1480764803-5577-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DdGowADH0eCErUJYv_83Iw--.24451S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZr1ktF4rCrW8CF45GryDJrb_yoW3ZFc_Gr 4xJFyrW3yrtr4DKw43Aw4fJF15tw1F9wn7CrWaqFZIqw1DC393uw4IgFn8Ar17W3ySkrWa 9r1DAa45Z34fCjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeN_-PUUUUU== X-Originating-IP: [222.131.246.88] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiDgI1clXlhmgmxwABs1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 772 Lines: 26 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; -- 1.9.1