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
b3ab09f9
Commit
b3ab09f9
authored
Nov 21, 2006
by
Arnaldo Carvalho de Melo
Committed by
David S. Miller
Dec 02, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IRDA]: Use kmemdup where applicable
Signed-off-by:
Arnaldo Carvalho de Melo
<
acme@mandriva.com
>
parent
8b2ed4bb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
10 deletions
+4
-10
net/irda/iriap.c
net/irda/iriap.c
+1
-2
net/irda/irias_object.c
net/irda/irias_object.c
+1
-3
net/irda/irlmp.c
net/irda/irlmp.c
+1
-3
net/irda/irqueue.c
net/irda/irqueue.c
+1
-2
No files found.
net/irda/iriap.c
View file @
b3ab09f9
...
@@ -172,7 +172,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
...
@@ -172,7 +172,7 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
IRDA_DEBUG
(
2
,
"%s()
\n
"
,
__FUNCTION__
);
IRDA_DEBUG
(
2
,
"%s()
\n
"
,
__FUNCTION__
);
self
=
k
malloc
(
sizeof
(
struct
iriap_cb
),
GFP_ATOMIC
);
self
=
k
zalloc
(
sizeof
(
*
self
),
GFP_ATOMIC
);
if
(
!
self
)
{
if
(
!
self
)
{
IRDA_WARNING
(
"%s: Unable to kmalloc!
\n
"
,
__FUNCTION__
);
IRDA_WARNING
(
"%s: Unable to kmalloc!
\n
"
,
__FUNCTION__
);
return
NULL
;
return
NULL
;
...
@@ -181,7 +181,6 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
...
@@ -181,7 +181,6 @@ struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
/*
/*
* Initialize instance
* Initialize instance
*/
*/
memset
(
self
,
0
,
sizeof
(
struct
iriap_cb
));
self
->
magic
=
IAS_MAGIC
;
self
->
magic
=
IAS_MAGIC
;
self
->
mode
=
mode
;
self
->
mode
=
mode
;
...
...
net/irda/irias_object.c
View file @
b3ab09f9
...
@@ -501,13 +501,12 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
...
@@ -501,13 +501,12 @@ struct ias_value *irias_new_octseq_value(__u8 *octseq , int len)
len
=
IAS_MAX_OCTET_STRING
;
len
=
IAS_MAX_OCTET_STRING
;
value
->
len
=
len
;
value
->
len
=
len
;
value
->
t
.
oct_seq
=
km
alloc
(
len
,
GFP_ATOMIC
);
value
->
t
.
oct_seq
=
km
emdup
(
octseq
,
len
,
GFP_ATOMIC
);
if
(
value
->
t
.
oct_seq
==
NULL
){
if
(
value
->
t
.
oct_seq
==
NULL
){
IRDA_WARNING
(
"%s: Unable to kmalloc!
\n
"
,
__FUNCTION__
);
IRDA_WARNING
(
"%s: Unable to kmalloc!
\n
"
,
__FUNCTION__
);
kfree
(
value
);
kfree
(
value
);
return
NULL
;
return
NULL
;
}
}
memcpy
(
value
->
t
.
oct_seq
,
octseq
,
len
);
return
value
;
return
value
;
}
}
...
@@ -522,7 +521,6 @@ struct ias_value *irias_new_missing_value(void)
...
@@ -522,7 +521,6 @@ struct ias_value *irias_new_missing_value(void)
}
}
value
->
type
=
IAS_MISSING
;
value
->
type
=
IAS_MISSING
;
value
->
len
=
0
;
return
value
;
return
value
;
}
}
...
...
net/irda/irlmp.c
View file @
b3ab09f9
...
@@ -641,15 +641,13 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
...
@@ -641,15 +641,13 @@ struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
}
}
/* Allocate a new instance */
/* Allocate a new instance */
new
=
km
alloc
(
sizeof
(
struct
lsap_cb
),
GFP_ATOMIC
);
new
=
km
emdup
(
orig
,
sizeof
(
*
new
),
GFP_ATOMIC
);
if
(
!
new
)
{
if
(
!
new
)
{
IRDA_DEBUG
(
0
,
"%s(), unable to kmalloc
\n
"
,
__FUNCTION__
);
IRDA_DEBUG
(
0
,
"%s(), unable to kmalloc
\n
"
,
__FUNCTION__
);
spin_unlock_irqrestore
(
&
irlmp
->
unconnected_lsaps
->
hb_spinlock
,
spin_unlock_irqrestore
(
&
irlmp
->
unconnected_lsaps
->
hb_spinlock
,
flags
);
flags
);
return
NULL
;
return
NULL
;
}
}
/* Dup */
memcpy
(
new
,
orig
,
sizeof
(
struct
lsap_cb
));
/* new->lap = orig->lap; => done in the memcpy() */
/* new->lap = orig->lap; => done in the memcpy() */
/* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */
/* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */
new
->
conn_skb
=
NULL
;
new
->
conn_skb
=
NULL
;
...
...
net/irda/irqueue.c
View file @
b3ab09f9
...
@@ -356,14 +356,13 @@ hashbin_t *hashbin_new(int type)
...
@@ -356,14 +356,13 @@ hashbin_t *hashbin_new(int type)
/*
/*
* Allocate new hashbin
* Allocate new hashbin
*/
*/
hashbin
=
k
malloc
(
sizeof
(
hashbin_t
),
GFP_ATOMIC
);
hashbin
=
k
zalloc
(
sizeof
(
*
hashbin
),
GFP_ATOMIC
);
if
(
!
hashbin
)
if
(
!
hashbin
)
return
NULL
;
return
NULL
;
/*
/*
* Initialize structure
* Initialize structure
*/
*/
memset
(
hashbin
,
0
,
sizeof
(
hashbin_t
));
hashbin
->
hb_type
=
type
;
hashbin
->
hb_type
=
type
;
hashbin
->
magic
=
HB_MAGIC
;
hashbin
->
magic
=
HB_MAGIC
;
//hashbin->hb_current = NULL;
//hashbin->hb_current = NULL;
...
...
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