All of lore.kernel.org
 help / color / mirror / Atom feed
From: andriy.shevchenko@linux.intel.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf
Date: Wed, 20 Jan 2016 11:36:10 +0200	[thread overview]
Message-ID: <1453282570.2521.130.camel@linux.intel.com> (raw)
In-Reply-To: <569F2DEC.9040209@huawei.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: "Yankejian (Hackim Yim)"
	<yankejian-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Yisen Zhuang
	<Yisen.zhuang-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	pawel.moll-5wv7dgnIgG8@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	catalin.marinas-5wv7dgnIgG8@public.gmane.org,
	will.deacon-5wv7dgnIgG8@public.gmane.org,
	huangdaode-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org,
	liguozhu-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	arnd-r2nGTMty4D4@public.gmane.org,
	fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	salil.mehta-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	lisheng011-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linuxarm-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf
Date: Wed, 20 Jan 2016 11:36:10 +0200	[thread overview]
Message-ID: <1453282570.2521.130.camel@linux.intel.com> (raw)
In-Reply-To: <569F2DEC.9040209-hv44wF8Li93QT0dZR+AlfA@public.gmane.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 <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Intel Finland Oy

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "Yankejian (Hackim Yim)" <yankejian@huawei.com>,
	Yisen Zhuang <Yisen.zhuang@huawei.com>,
	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
Subject: Re: [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf
Date: Wed, 20 Jan 2016 11:36:10 +0200	[thread overview]
Message-ID: <1453282570.2521.130.camel@linux.intel.com> (raw)
In-Reply-To: <569F2DEC.9040209@huawei.com>

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

  reply	other threads:[~2016-01-20  9:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13  3:14 [PATCH v2 next-next] net: hns: enet specifies a reference to dsaf Kejian Yan
2016-01-13  3:14 ` Kejian Yan
2016-01-13  3:14 ` Kejian Yan
2016-01-14  3:00 ` Yisen Zhuang
2016-01-14  3:00   ` Yisen Zhuang
2016-01-14  3:00   ` Yisen Zhuang
2016-01-14  9:43   ` Andy Shevchenko
2016-01-14  9:43     ` Andy Shevchenko
2016-01-14  9:43     ` Andy Shevchenko
2016-01-18 11:35     ` Yankejian (Hackim Yim)
2016-01-18 11:35       ` Yankejian (Hackim Yim)
2016-01-18 11:35       ` Yankejian (Hackim Yim)
2016-01-18 11:35       ` Yankejian (Hackim Yim)
2016-01-20  6:49     ` Yankejian (Hackim Yim)
2016-01-20  9:36       ` Andy Shevchenko [this message]
2016-01-20  9:36         ` Andy Shevchenko
2016-01-20  9:36         ` Andy Shevchenko
2016-01-20 11:10         ` Yankejian (Hackim Yim)
2016-01-20 11:10           ` Yankejian (Hackim Yim)
2016-01-20 11:10           ` Yankejian (Hackim Yim)
2016-01-15  2:28 ` Rob Herring
2016-01-15  2:28   ` Rob Herring
2016-01-15  2:28   ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2016-01-13  3:01 Kejian Yan
2016-01-13  3:01 ` Kejian Yan
2016-01-13  3:01 ` Kejian Yan
2016-01-13  2:52 ` Yankejian (Hackim Yim)
2016-01-13  2:52   ` Yankejian (Hackim Yim)
2016-01-13  2:52   ` Yankejian (Hackim Yim)
2016-01-13  2:54 ` David Miller
2016-01-13  2:54   ` David Miller
2016-01-13  3:00   ` Yankejian (Hackim Yim)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453282570.2521.130.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.