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
64b133d2
Commit
64b133d2
authored
Jul 19, 2003
by
Javier Achirica
Committed by
Jeff Garzik
Jul 19, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wireless airo] Simplify dynamic buffer code in Cisco extensions.
parent
4a383d75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
45 deletions
+42
-45
drivers/net/wireless/airo.c
drivers/net/wireless/airo.c
+42
-45
No files found.
drivers/net/wireless/airo.c
View file @
64b133d2
...
@@ -5902,13 +5902,9 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5902,13 +5902,9 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
unsigned
short
ridcode
;
unsigned
short
ridcode
;
unsigned
char
*
iobuf
;
unsigned
char
*
iobuf
;
struct
airo_info
*
ai
=
dev
->
priv
;
struct
airo_info
*
ai
=
dev
->
priv
;
int
ret
=
0
;
if
(
ai
->
flags
&
FLAG_FLASHING
)
if
(
ai
->
flags
&
FLAG_FLASHING
)
return
-
EIO
;
return
-
EIO
;
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
);
if
(
!
iobuf
)
return
-
ENOMEM
;
switch
(
comp
->
command
)
switch
(
comp
->
command
)
{
{
...
@@ -5921,17 +5917,13 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5921,17 +5917,13 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
case
AIROGEHTENC
:
ridcode
=
RID_ETHERENCAP
;
break
;
case
AIROGEHTENC
:
ridcode
=
RID_ETHERENCAP
;
break
;
case
AIROGWEPKTMP
:
ridcode
=
RID_WEP_TEMP
;
case
AIROGWEPKTMP
:
ridcode
=
RID_WEP_TEMP
;
/* Only super-user can read WEP keys */
/* Only super-user can read WEP keys */
if
(
!
capable
(
CAP_NET_ADMIN
))
{
if
(
!
capable
(
CAP_NET_ADMIN
))
ret
=
-
EPERM
;
return
-
EPERM
;
goto
rr_free
;
}
break
;
break
;
case
AIROGWEPKNV
:
ridcode
=
RID_WEP_PERM
;
case
AIROGWEPKNV
:
ridcode
=
RID_WEP_PERM
;
/* Only super-user can read WEP keys */
/* Only super-user can read WEP keys */
if
(
!
capable
(
CAP_NET_ADMIN
))
{
if
(
!
capable
(
CAP_NET_ADMIN
))
ret
=
-
EPERM
;
return
-
EPERM
;
goto
rr_free
;
}
break
;
break
;
case
AIROGSTAT
:
ridcode
=
RID_STATUS
;
break
;
case
AIROGSTAT
:
ridcode
=
RID_STATUS
;
break
;
case
AIROGSTATSD32
:
ridcode
=
RID_STATSDELTA
;
break
;
case
AIROGSTATSD32
:
ridcode
=
RID_STATSDELTA
;
break
;
...
@@ -5939,13 +5931,16 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5939,13 +5931,16 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
case
AIROGMICSTATS
:
case
AIROGMICSTATS
:
if
(
copy_to_user
(
comp
->
data
,
&
ai
->
micstats
,
if
(
copy_to_user
(
comp
->
data
,
&
ai
->
micstats
,
min
((
int
)
comp
->
len
,(
int
)
sizeof
(
ai
->
micstats
))))
min
((
int
)
comp
->
len
,(
int
)
sizeof
(
ai
->
micstats
))))
ret
=
-
EFAULT
;
ret
urn
-
EFAULT
;
goto
rr_free
;
return
0
;
default:
default:
ret
=
-
EINVAL
;
ret
urn
-
EINVAL
;
goto
rr_free
;
break
;
}
}
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
return
-
ENOMEM
;
PC4500_readrid
(
ai
,
ridcode
,
iobuf
,
RIDS_SIZE
);
PC4500_readrid
(
ai
,
ridcode
,
iobuf
,
RIDS_SIZE
);
/* get the count of bytes in the rid docs say 1st 2 bytes is it.
/* get the count of bytes in the rid docs say 1st 2 bytes is it.
* then return it to the user
* then return it to the user
...
@@ -5953,11 +5948,12 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5953,11 +5948,12 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
*/
*/
if
(
copy_to_user
(
comp
->
data
,
iobuf
,
if
(
copy_to_user
(
comp
->
data
,
iobuf
,
min
((
int
)
comp
->
len
,
(
int
)
RIDS_SIZE
)))
min
((
int
)
comp
->
len
,
(
int
)
RIDS_SIZE
)))
{
ret
=
-
EFAULT
;
kfree
(
iobuf
);
rr_free:
return
-
EFAULT
;
kfree
(
iobuf
);
}
return
ret
;
kfree
(
iobuf
);
return
0
;
}
}
/*
/*
...
@@ -5970,7 +5966,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5970,7 +5966,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
Resp
rsp
;
Resp
rsp
;
static
int
(
*
writer
)(
struct
airo_info
*
,
u16
rid
,
const
void
*
,
int
);
static
int
(
*
writer
)(
struct
airo_info
*
,
u16
rid
,
const
void
*
,
int
);
unsigned
char
*
iobuf
;
unsigned
char
*
iobuf
;
int
ret
=
0
;
/* Only super-user can write RIDs */
/* Only super-user can write RIDs */
if
(
!
capable
(
CAP_NET_ADMIN
))
if
(
!
capable
(
CAP_NET_ADMIN
))
...
@@ -5979,10 +5974,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -5979,10 +5974,6 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
if
(
ai
->
flags
&
FLAG_FLASHING
)
if
(
ai
->
flags
&
FLAG_FLASHING
)
return
-
EIO
;
return
-
EIO
;
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
);
if
(
!
iobuf
)
return
-
ENOMEM
;
ridcode
=
0
;
ridcode
=
0
;
writer
=
do_writerid
;
writer
=
do_writerid
;
...
@@ -6004,8 +5995,8 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6004,8 +5995,8 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
*/
*/
case
AIROPMACON
:
case
AIROPMACON
:
if
(
enable_MAC
(
ai
,
&
rsp
)
!=
0
)
if
(
enable_MAC
(
ai
,
&
rsp
)
!=
0
)
ret
=
-
EIO
;
ret
urn
-
EIO
;
goto
wr_free
;
return
0
;
/*
/*
* Evidently this code in the airo driver does not get a symbol
* Evidently this code in the airo driver does not get a symbol
...
@@ -6013,13 +6004,16 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6013,13 +6004,16 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
*/
*/
case
AIROPMACOFF
:
case
AIROPMACOFF
:
disable_MAC
(
ai
);
disable_MAC
(
ai
);
goto
wr_free
;
return
0
;
/* This command merely clears the counts does not actually store any data
/* This command merely clears the counts does not actually store any data
* only reads rid. But as it changes the cards state, I put it in the
* only reads rid. But as it changes the cards state, I put it in the
* writerid routines.
* writerid routines.
*/
*/
case
AIROPSTCLR
:
case
AIROPSTCLR
:
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
return
-
ENOMEM
;
PC4500_readrid
(
ai
,
RID_STATSDELTACLEAR
,
iobuf
,
RIDS_SIZE
);
PC4500_readrid
(
ai
,
RID_STATSDELTACLEAR
,
iobuf
,
RIDS_SIZE
);
enabled
=
ai
->
micstats
.
enabled
;
enabled
=
ai
->
micstats
.
enabled
;
...
@@ -6027,23 +6021,25 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6027,23 +6021,25 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
ai
->
micstats
.
enabled
=
enabled
;
ai
->
micstats
.
enabled
=
enabled
;
if
(
copy_to_user
(
comp
->
data
,
iobuf
,
if
(
copy_to_user
(
comp
->
data
,
iobuf
,
min
((
int
)
comp
->
len
,
(
int
)
RIDS_SIZE
)))
min
((
int
)
comp
->
len
,
(
int
)
RIDS_SIZE
)))
{
ret
=
-
EFAULT
;
kfree
(
iobuf
);
goto
wr_free
;
return
-
EFAULT
;
}
kfree
(
iobuf
);
return
0
;
default:
default:
ret
=
-
EOPNOTSUPP
;
/* Blarg! */
return
-
EOPNOTSUPP
;
/* Blarg! */
goto
wr_free
;
}
}
if
(
comp
->
len
>
RIDS_SIZE
)
return
-
EINVAL
;
if
(
comp
->
len
>
RIDS_SIZE
)
{
if
((
iobuf
=
kmalloc
(
RIDS_SIZE
,
GFP_KERNEL
))
==
NULL
)
ret
=
-
EINVAL
;
return
-
ENOMEM
;
goto
wr_free
;
}
if
(
copy_from_user
(
iobuf
,
comp
->
data
,
comp
->
len
))
{
if
(
copy_from_user
(
iobuf
,
comp
->
data
,
comp
->
len
))
{
ret
=
-
EFAULT
;
kfree
(
iobuf
)
;
goto
wr_free
;
return
-
EFAULT
;
}
}
if
(
comp
->
command
==
AIROPCFG
)
{
if
(
comp
->
command
==
AIROPCFG
)
{
...
@@ -6058,11 +6054,12 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
...
@@ -6058,11 +6054,12 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
ai
->
flags
&=
~
FLAG_ADHOC
;
ai
->
flags
&=
~
FLAG_ADHOC
;
}
}
if
((
*
writer
)(
ai
,
ridcode
,
iobuf
,
comp
->
len
))
if
((
*
writer
)(
ai
,
ridcode
,
iobuf
,
comp
->
len
))
{
ret
=
-
EIO
;
kfree
(
iobuf
);
wr_free:
return
-
EIO
;
kfree
(
iobuf
);
}
return
ret
;
kfree
(
iobuf
);
return
0
;
}
}
/*****************************************************************************
/*****************************************************************************
...
...
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