From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758274AbcATJiX (ORCPT ); Wed, 20 Jan 2016 04:38:23 -0500 Received: from mga04.intel.com ([192.55.52.120]:48050 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751627AbcATJiO (ORCPT ); Wed, 20 Jan 2016 04:38:14 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,320,1449561600"; d="scan'208";a="894495438" Message-ID: <1453282570.2521.130.camel@linux.intel.com> Subject: Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf From: Andy Shevchenko To: "Yankejian (Hackim Yim)" , Yisen Zhuang , davem@davemloft.net, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, catalin.marinas@arm.com, will.deacon@arm.com, huangdaode@hisilicon.com, liguozhu@huawei.com, arnd@arndb.de, fengguang.wu@intel.com, salil.mehta@huawei.com, lisheng011@huawei.com Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linuxarm@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Date: Wed, 20 Jan 2016 11:36:10 +0200 In-Reply-To: <569F2DEC.9040209@huawei.com> References: <1452654880-28980-1-git-send-email-yankejian@huawei.com> <56970F48.9060504@huawei.com> <1452764635.2521.28.camel@linux.intel.com> <569F2DEC.9040209@huawei.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.18.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-01-20 at 14:49 +0800, Yankejian (Hackim Yim) wrote: > > > + > > > > > > + snprintf(ae_dev->name, AE_NAME_SIZE, "%s%d", > > > > > > DSAF_DEVICE_NAME, > > > > > > +  (int)atomic_inc_return(&id)); > > If you bind/unbind device enough times you may get an overflow and > > end > > up with name of existing device (if you have 1+ of them in the > > system). > > > > To avoid such situation better to use IDA/IDR framework. > > > Hi, Andy > Thanks again for your suggestion. > It seems that using IDA/IDR framework is better, but all of the > functions must be serialized by lock. AFAIR it's designed in a way you don't need to do any additional locking or synchronization. -- Andy Shevchenko Intel Finland Oy