| To: | YOSHIFUJI Hideaki / ____________ <yoshfuji@xxxxxxxxxxxxxx>, davem@xxxxxxxxxx |
|---|---|
| Subject: | Re: [PATCH] (2/4) support large number of network devices -- name hash |
| From: | Stephen Hemminger <shemminger@xxxxxxxx> |
| Date: | Mon, 19 Jan 2004 11:28:50 -0800 |
| Cc: | netdev@xxxxxxxxxxx, yoshfuji@xxxxxxxxxxxxxx |
| In-reply-to: | <20040117.112244.90941296.yoshfuji@xxxxxxxxxxxxxx> |
| Organization: | Open Source Development Lab |
| References: | <20040116154652.04dd3324.shemminger@xxxxxxxx> <20040116154814.7c7f31ac.shemminger@xxxxxxxx> <20040117.112244.90941296.yoshfuji@xxxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
Use strnlen, great idea, thanks.
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c Mon Jan 19 11:30:20 2004
+++ b/net/core/dev.c Mon Jan 19 11:30:20 2004
@@ -192,8 +192,8 @@
static inline struct hlist_head *dev_name_hash(const char *name)
{
- size_t len = min(strlen(name),(size_t)(IFNAMSIZ-1));
- unsigned hash = full_name_hash(name, len);
+ unsigned hash = full_name_hash(name,
+ strnlen(name, IFNAMSIZ-1));
return &dev_name_head[hash & ((1<<NETDEV_HASHBITS)-1)];
}
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: 8139 resetting problem, Jeff Garzik |
|---|---|
| Next by Date: | [PATCH] more improvement to dev_alloc_name -- strnchr, Stephen Hemminger |
| Previous by Thread: | Re: [PATCH] (2/4) support large number of network devices -- name hash, YOSHIFUJI Hideaki / 吉藤英明 |
| Next by Thread: | Re: [PATCH] (2/4) support large number of network devices -- name hash, YOSHIFUJI Hideaki / 吉藤英明 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |