Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
20629147
Commit
20629147
authored
May 24, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make driver model use 'strlcpy()' to make sure that all
names are NUL-terminated Noted by Ben Collins.
parent
0297761d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
drivers/base/bus.c
drivers/base/bus.c
+2
-2
drivers/base/class.c
drivers/base/class.c
+2
-2
drivers/base/core.c
drivers/base/core.c
+1
-1
No files found.
drivers/base/bus.c
View file @
20629147
...
@@ -431,7 +431,7 @@ int bus_add_driver(struct device_driver * drv)
...
@@ -431,7 +431,7 @@ int bus_add_driver(struct device_driver * drv)
if
(
bus
)
{
if
(
bus
)
{
pr_debug
(
"bus %s: add driver %s
\n
"
,
bus
->
name
,
drv
->
name
);
pr_debug
(
"bus %s: add driver %s
\n
"
,
bus
->
name
,
drv
->
name
);
str
n
cpy
(
drv
->
kobj
.
name
,
drv
->
name
,
KOBJ_NAME_LEN
);
str
l
cpy
(
drv
->
kobj
.
name
,
drv
->
name
,
KOBJ_NAME_LEN
);
drv
->
kobj
.
kset
=
&
bus
->
drivers
;
drv
->
kobj
.
kset
=
&
bus
->
drivers
;
if
((
error
=
kobject_register
(
&
drv
->
kobj
)))
{
if
((
error
=
kobject_register
(
&
drv
->
kobj
)))
{
...
@@ -540,7 +540,7 @@ struct bus_type * find_bus(char * name)
...
@@ -540,7 +540,7 @@ struct bus_type * find_bus(char * name)
*/
*/
int
bus_register
(
struct
bus_type
*
bus
)
int
bus_register
(
struct
bus_type
*
bus
)
{
{
str
n
cpy
(
bus
->
subsys
.
kset
.
kobj
.
name
,
bus
->
name
,
KOBJ_NAME_LEN
);
str
l
cpy
(
bus
->
subsys
.
kset
.
kobj
.
name
,
bus
->
name
,
KOBJ_NAME_LEN
);
subsys_set_kset
(
bus
,
bus_subsys
);
subsys_set_kset
(
bus
,
bus_subsys
);
subsystem_register
(
&
bus
->
subsys
);
subsystem_register
(
&
bus
->
subsys
);
...
...
drivers/base/class.c
View file @
20629147
...
@@ -88,7 +88,7 @@ int class_register(struct class * cls)
...
@@ -88,7 +88,7 @@ int class_register(struct class * cls)
INIT_LIST_HEAD
(
&
cls
->
children
);
INIT_LIST_HEAD
(
&
cls
->
children
);
INIT_LIST_HEAD
(
&
cls
->
interfaces
);
INIT_LIST_HEAD
(
&
cls
->
interfaces
);
str
n
cpy
(
cls
->
subsys
.
kset
.
kobj
.
name
,
cls
->
name
,
KOBJ_NAME_LEN
);
str
l
cpy
(
cls
->
subsys
.
kset
.
kobj
.
name
,
cls
->
name
,
KOBJ_NAME_LEN
);
subsys_set_kset
(
cls
,
class_subsys
);
subsys_set_kset
(
cls
,
class_subsys
);
subsystem_register
(
&
cls
->
subsys
);
subsystem_register
(
&
cls
->
subsys
);
...
@@ -258,7 +258,7 @@ int class_device_add(struct class_device *class_dev)
...
@@ -258,7 +258,7 @@ int class_device_add(struct class_device *class_dev)
class_dev
->
class_id
);
class_dev
->
class_id
);
/* first, register with generic layer. */
/* first, register with generic layer. */
str
n
cpy
(
class_dev
->
kobj
.
name
,
class_dev
->
class_id
,
KOBJ_NAME_LEN
);
str
l
cpy
(
class_dev
->
kobj
.
name
,
class_dev
->
class_id
,
KOBJ_NAME_LEN
);
kobj_set_kset_s
(
class_dev
,
class_obj_subsys
);
kobj_set_kset_s
(
class_dev
,
class_obj_subsys
);
if
(
parent
)
if
(
parent
)
class_dev
->
kobj
.
parent
=
&
parent
->
subsys
.
kset
.
kobj
;
class_dev
->
kobj
.
parent
=
&
parent
->
subsys
.
kset
.
kobj
;
...
...
drivers/base/core.c
View file @
20629147
...
@@ -211,7 +211,7 @@ int device_add(struct device *dev)
...
@@ -211,7 +211,7 @@ int device_add(struct device *dev)
dev
->
bus_id
,
dev
->
name
);
dev
->
bus_id
,
dev
->
name
);
/* first, register with generic layer. */
/* first, register with generic layer. */
str
n
cpy
(
dev
->
kobj
.
name
,
dev
->
bus_id
,
KOBJ_NAME_LEN
);
str
l
cpy
(
dev
->
kobj
.
name
,
dev
->
bus_id
,
KOBJ_NAME_LEN
);
if
(
parent
)
if
(
parent
)
dev
->
kobj
.
parent
=
&
parent
->
kobj
;
dev
->
kobj
.
parent
=
&
parent
->
kobj
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment