Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1313036 > unrolled thread

Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf

Started byAndy Shevchenko <andriy.shevchenko@linux.intel.com>
First post2016-01-20 10:40 +0100
Last post2016-01-20 12:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 next-next] net: hns: enet specifies a reference to  dsaf Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-01-20 10:40 +0100
    Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf "Yankejian (Hackim Yim)" <yankejian@huawei.com> - 2016-01-20 12:20 +0100

#1313036 — Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf

FromAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Date2016-01-20 10:40 +0100
SubjectRe: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf
Message-ID<qSXp7-4uM-7@gated-at.bofh.it>
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 <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

[toc] | [next] | [standalone]


#1313136 — Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf

From"Yankejian (Hackim Yim)" <yankejian@huawei.com>
Date2016-01-20 12:20 +0100
SubjectRe: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf
Message-ID<qSYXU-5Aj-23@gated-at.bofh.it>
In reply to#1313036

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web