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
650e56ee
Commit
650e56ee
authored
Sep 24, 2002
by
Thomas Hood
Committed by
Jens Axboe
Sep 24, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] PnP BIOS ESCD sanity check
Sanity checkthe ESCD size. From 2.4.
parent
26b90050
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
drivers/pnp/pnpbios_proc.c
drivers/pnp/pnpbios_proc.c
+11
-3
No files found.
drivers/pnp/pnpbios_proc.c
View file @
650e56ee
...
@@ -68,6 +68,7 @@ static int proc_read_escdinfo(char *buf, char **start, off_t pos,
...
@@ -68,6 +68,7 @@ static int proc_read_escdinfo(char *buf, char **start, off_t pos,
);
);
}
}
#define MAX_SANE_ESCD_SIZE (32*1024)
static
int
proc_read_escd
(
char
*
buf
,
char
**
start
,
off_t
pos
,
static
int
proc_read_escd
(
char
*
buf
,
char
**
start
,
off_t
pos
,
int
count
,
int
*
eof
,
void
*
data
)
int
count
,
int
*
eof
,
void
*
data
)
{
{
...
@@ -79,8 +80,8 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
...
@@ -79,8 +80,8 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
return
-
EIO
;
return
-
EIO
;
/* sanity check */
/* sanity check */
if
(
escd
.
escd_size
>
(
32
*
1024
)
)
{
if
(
escd
.
escd_size
>
MAX_SANE_ESCD_SIZE
)
{
printk
(
KERN_ERR
"PnPBIOS: proc_read_escd: ESCD size is too great
\n
"
);
printk
(
KERN_ERR
"PnPBIOS: proc_read_escd: ESCD size
reported by BIOS escd_info call
is too great
\n
"
);
return
-
EFBIG
;
return
-
EFBIG
;
}
}
...
@@ -90,7 +91,14 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
...
@@ -90,7 +91,14 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
if
(
pnp_bios_read_escd
(
tmpbuf
,
escd
.
nv_storage_base
))
if
(
pnp_bios_read_escd
(
tmpbuf
,
escd
.
nv_storage_base
))
return
-
EIO
;
return
-
EIO
;
escd_size
=
(
unsigned
char
)(
buf
[
0
])
+
(
unsigned
char
)(
buf
[
1
])
*
256
;
escd_size
=
(
unsigned
char
)(
tmpbuf
[
0
])
+
(
unsigned
char
)(
tmpbuf
[
1
])
*
256
;
/* sanity check */
if
(
escd_size
>
MAX_SANE_ESCD_SIZE
)
{
printk
(
KERN_ERR
"PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great
\n
"
);
return
-
EFBIG
;
}
escd_left_to_read
=
escd_size
-
pos
;
escd_left_to_read
=
escd_size
-
pos
;
if
(
escd_left_to_read
<
0
)
escd_left_to_read
=
0
;
if
(
escd_left_to_read
<
0
)
escd_left_to_read
=
0
;
if
(
escd_left_to_read
==
0
)
*
eof
=
1
;
if
(
escd_left_to_read
==
0
)
*
eof
=
1
;
...
...
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