From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935212AbcATLMK (ORCPT ); Wed, 20 Jan 2016 06:12:10 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:38410 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934600AbcATLME (ORCPT ); Wed, 20 Jan 2016 06:12:04 -0500 Subject: Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf To: Andy Shevchenko , Yisen Zhuang , , , , , , , , , , , , , , 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> <1453282570.2521.130.camel@linux.intel.com> CC: , , , , From: "Yankejian (Hackim Yim)" Message-ID: <569F6B1B.6080902@huawei.com> Date: Wed, 20 Jan 2016 19:10:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1453282570.2521.130.camel@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.57.126.191] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.569F6B53.0057,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8db63fbfd160a2edca1c703a6ddfc542 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2016/1/20 17:36, Andy Shevchenko wrote: > 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. really? if so, that is great. could you sent me an example. thanks very much. Andy. Best Regards, Kejian Yan